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

13 lines
421 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): Promise<Location> => {
return new Promise((resolve, reject) => {
http.post('/api/application/locations', {
short, long,
})
2021-01-06 23:38:39 +00:00
.then(({ data }) => resolve(rawDataToLocation(data)))
2021-01-06 22:39:23 +00:00
.catch(reject);
});
};