import http from '@/api/http'; import { Server, rawDataToServer } from '@/api/admin/servers/getServers'; export interface Values { startup: string; environment: Record; eggId: number; image: string; skipScripts: boolean; } export default (id: number, values: Partial, include: string[] = []): Promise => { 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, }, { params: { include: include.join(',') } } ) .then(({ data }) => resolve(rawDataToServer(data))) .catch(reject); }); };