misc_pterodactyl-panel/resources/scripts/api/admin/nests/createNest.ts

13 lines
479 B
TypeScript
Raw Normal View History

2021-01-01 00:27:16 +00:00
import http from '@/api/http';
2021-01-06 23:38:39 +00:00
import { Nest, rawDataToNest } from '@/api/admin/nests/getNests';
2021-01-01 00:27:16 +00:00
export default (name: string, description: string | null, include: string[] = []): Promise<Nest> => {
2021-01-01 00:27:16 +00:00
return new Promise((resolve, reject) => {
http.post('/api/application/nests', {
name, description,
}, { params: { include: include.join(',') } })
2021-01-06 23:38:39 +00:00
.then(({ data }) => resolve(rawDataToNest(data)))
2021-01-01 00:27:16 +00:00
.catch(reject);
});
};