misc_pterodactyl-panel/resources/scripts/api/admin/locations/createLocation.ts

13 lines
495 B
TypeScript
Raw Normal View History

2021-01-06 22:39:23 +00:00
import http from '@/api/http';
2021-01-06 23:38:39 +00:00
import { Location, rawDataToLocation } from '@/api/admin/locations/getLocations';
2021-01-06 22:39:23 +00:00
export default (short: string, long: string | null, include: string[] = []): Promise<Location> => {
2021-01-06 22:39:23 +00:00
return new Promise((resolve, reject) => {
http.post('/api/application/locations', {
short, long,
}, { params: { include: include.join(',') } })
2021-01-06 23:38:39 +00:00
.then(({ data }) => resolve(rawDataToLocation(data)))
2021-01-06 22:39:23 +00:00
.catch(reject);
});
};