add functionality and refactor the code

This commit is contained in:
2024-08-31 08:19:41 +00:00
parent 32d9bc96b5
commit be78e17fb9
7 changed files with 207 additions and 76 deletions

View File

@@ -0,0 +1,22 @@
export default function helpers(pterodactyl: any) {
return {
// helper what return auth header
async authHeader() {
return {
Authorization: `Bearer ${pterodactyl.api_key}`,
"Content-Type": "application/json",
Accept: "Application/vnd.pterodactyl.v1+json",
};
},
// setter for api key
async setApiKey(apiKey: string) {
return (pterodactyl.api_key = apiKey);
},
// setter for server id
async setServerID(serverID: string) {
return (pterodactyl.server_id = serverID);
},
};
}