misc_pterodactyl-panel/resources/scripts/api/admin/nests/importEgg.ts
2021-09-17 13:48:20 -06:00

17 lines
587 B
TypeScript

import http from '@/api/http';
import { Egg, rawDataToEgg } from '@/api/admin/eggs/getEgg';
export default (id: number, content: any, type = 'application/json', include: string[] = []): Promise<Egg> => {
return new Promise((resolve, reject) => {
http.post(`/api/application/nests/${id}/import`, content, {
headers: {
'Content-Type': type,
},
params: {
include: include.join(','),
},
})
.then(({ data }) => resolve(rawDataToEgg(data)))
.catch(reject);
});
};