misc_pterodactyl-panel/resources/scripts/api/swr/getServerStartup.ts
Charles Morgan 3473e1dfbf
Remove console logging (#2415)
Remove console logging, as its not an error being logged i see no reason for this to be printed when the startup page is viewed.
2020-10-03 11:23:16 -07:00

17 lines
689 B
TypeScript

import useSWR from 'swr';
import http, { FractalResponseList } from '@/api/http';
import { rawDataToServerEggVariable } from '@/api/transformers';
import { ServerEggVariable } from '@/api/server/types';
interface Response {
invocation: string;
variables: ServerEggVariable[];
}
export default (uuid: string, initialData?: Response) => useSWR([ uuid, '/startup' ], async (): Promise<Response> => {
const { data } = await http.get(`/api/client/servers/${uuid}/startup`);
const variables = ((data as FractalResponseList).data || []).map(rawDataToServerEggVariable);
return { invocation: data.meta.startup_command, variables };
}, { initialData, errorRetryCount: 3 });