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);
|
|
|
|
});
|
|
|
|
};
|