misc_pterodactyl-panel/resources/scripts/api/admin/servers/updateServerStartup.ts

29 lines
921 B
TypeScript
Raw Normal View History

import http from '@/api/http';
import { Server, rawDataToServer } from '@/api/admin/servers/getServers';
export interface Values {
startup: string;
environment: Record<string, any>;
eggId: number;
image: string;
skipScripts: boolean;
}
export default (id: number, values: Partial<Values>, include: string[] = []): Promise<Server> => {
return new Promise((resolve, reject) => {
http.patch(
`/api/application/servers/${id}/startup`,
{
startup: values.startup !== '' ? values.startup : null,
environment: values.environment,
egg_id: values.eggId,
image: values.image,
skip_scripts: values.skipScripts,
},
2023-01-12 19:31:47 +00:00
{ params: { include: include.join(',') } },
)
.then(({ data }) => resolve(rawDataToServer(data)))
.catch(reject);
});
};