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
|
|
|
|
2021-01-15 16:41:15 +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,
|
2021-01-15 16:41:15 +00:00
|
|
|
}, { 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);
|
|
|
|
});
|
|
|
|
};
|