misc_pterodactyl-panel/resources/scripts/api/admin/eggs/createEgg.ts
2021-01-08 09:26:57 -07:00

12 lines
397 B
TypeScript

import http from '@/api/http';
import { Egg, rawDataToEgg } from '@/api/admin/eggs/getEgg';
export default (nestId: number, name: string): Promise<Egg> => {
return new Promise((resolve, reject) => {
http.post('/api/application/eggs', {
nestId, name,
})
.then(({ data }) => resolve(rawDataToEgg(data.attributes)))
.catch(reject);
});
};