This commit is contained in:
@@ -204,7 +204,7 @@ export default {
|
||||
this.track
|
||||
] = await Promise.all([
|
||||
this.api.get('markers', {id_project: this.project.id}),
|
||||
this.api.get('geojson', {id_project: this.project.id})
|
||||
this.api.getAsset(this.project.geofilepath)
|
||||
]);
|
||||
|
||||
await this.initMap();
|
||||
|
||||
@@ -14,6 +14,16 @@ export default class Api {
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async getAsset(sAssetPath) {
|
||||
const oRequest = await fetch(sAssetPath, {headers: {'Accept': 'application/geo+json'}});
|
||||
|
||||
if(!oRequest.ok) {
|
||||
throw new Error('Error HTTP ' + oRequest.status + ': ' + oRequest.statusText);
|
||||
}
|
||||
|
||||
return oRequest.json();
|
||||
}
|
||||
|
||||
async post(sAction, asParams = {}) {
|
||||
const response = await this.request(sAction, asParams, 'POST');
|
||||
return response.data;
|
||||
|
||||
Reference in New Issue
Block a user