mirror of
https://github.com/KevinMidboe/nova-map-fields.git
synced 2025-10-29 17:50:27 +00:00
Get mapbox api token from window
This commit is contained in:
@@ -44,11 +44,12 @@ export default {
|
|||||||
return {
|
return {
|
||||||
localValue: {},
|
localValue: {},
|
||||||
routeTypes: [{
|
routeTypes: [{
|
||||||
value: 'driving',
|
value: 'driving',
|
||||||
name: 'Bil'
|
name: 'Bil'
|
||||||
}, {
|
},
|
||||||
value: 'walking',
|
{
|
||||||
name: 'Gange'
|
value: 'walking',
|
||||||
|
name: 'Gange'
|
||||||
}],
|
}],
|
||||||
selectedRouteType: null
|
selectedRouteType: null
|
||||||
};
|
};
|
||||||
@@ -68,7 +69,8 @@ export default {
|
|||||||
.map((marker) => `${marker.lng},${marker.lat}`)
|
.map((marker) => `${marker.lng},${marker.lat}`)
|
||||||
.join(";");
|
.join(";");
|
||||||
|
|
||||||
const URL = `https://api.mapbox.com/directions/v5/mapbox/${this.selectedRouteType}/${cords}?geometries=geojson&access_token=pk.eyJ1Ijoia2V2aW5taWRib2UiLCJhIjoiY2pydWhlamQyMHJ2NTRhdGN1em5ndXVyMyJ9.Ejdo_3iuuGOD662Bh6es4w`;
|
const API_URL = 'https://api.mapbox.com/directions/v5'
|
||||||
|
const URL = `${API_URL}/mapbox/${this.selectedRouteType}/${cords}?geometries=geojson&access_token=${window.fjordmap.mapbox_access_token}`;
|
||||||
return fetch(URL)
|
return fetch(URL)
|
||||||
.then((resp) => resp.json())
|
.then((resp) => resp.json())
|
||||||
.then((response) => response.routes[0].geometry.coordinates)
|
.then((response) => response.routes[0].geometry.coordinates)
|
||||||
|
|||||||
Reference in New Issue
Block a user