diff --git a/src/assets/js/map-util.js b/src/assets/js/map-util.js index 3f63f5e64f04e5cb88e778a6a73fde5fd732421d..9e2ce68ce8348ce6196c83068f840af76d94a96e 100644 --- a/src/assets/js/map-util.js +++ b/src/assets/js/map-util.js @@ -298,9 +298,8 @@ const mapUtil = { this.addLayers(layers); }, // eslint-disable-next-line no-unused-vars - addVectorTileLayer: function (project_slug,featureTypes,form_filters) { - let project_id=project_slug.split('-')[0]; - layerMVT = L.vectorGrid.protobuf("/api/features.mvt/?tile={z}/{x}/{y}&project_id="+project_id, { // + addVectorTileLayer: function (url,project_slug,featureTypes,form_filters) { + layerMVT = L.vectorGrid.protobuf(url, { vectorTileLayerStyles: { "default": function(properties, zoom) { // console.log(properties); diff --git a/src/main.js b/src/main.js index 4a1f3128cd2ba8ca6a755be82f949b99d29851ad..edda9a1c273cc6f4ba771411c3e3ae8617dc3ed9 100644 --- a/src/main.js +++ b/src/main.js @@ -12,13 +12,16 @@ Vue.config.productionTip = false // gestion mise à jour du serviceWorker et du precache var refreshing=false; -navigator.serviceWorker.addEventListener('controllerchange', () => { - // We'll also need to add 'refreshing' to our data originally set to false. - if (refreshing) return - refreshing = true - // Here the actual reload of the page occurs - window.location.reload() -}) +if(navigator.serviceWorker){ + navigator.serviceWorker.addEventListener('controllerchange', () => { + // We'll also need to add 'refreshing' to our data originally set to false. + if (refreshing) return + refreshing = true + // Here the actual reload of the page occurs + window.location.reload() + }) +} + let onConfigLoaded = function(config){ diff --git a/src/views/feature/Feature_edit.vue b/src/views/feature/Feature_edit.vue index 15e572e03493e85d5ff4cd61f31d8448f437357c..54783c45b15cfa7e040cd66c004bb045249f065c 100644 --- a/src/views/feature/Feature_edit.vue +++ b/src/views/feature/Feature_edit.vue @@ -919,7 +919,10 @@ export default { const currentFeatureId = this.$route.params.slug_signal; setTimeout( function () { - mapUtil.addVectorTileLayer(this.$route.params.slug,this.$store.state.feature_type.feature_types); + let project_id=this.$route.params.slug.split('-')[0]; + const mvtUrl = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}/features.mvt/?tile={z}/{x}/{y}&project_id=${project_id}`; + + mapUtil.addVectorTileLayer(mvtUrl,this.$route.params.slug,this.$store.state.feature_type.feature_types); }.bind(this), 1000 ); diff --git a/src/views/feature/Feature_list.vue b/src/views/feature/Feature_list.vue index f136b2be8f3cc49456b218c48ce68c8600b3bb3c..394a83045d9553f390ddcb7d5e48712cdc08a073 100644 --- a/src/views/feature/Feature_list.vue +++ b/src/views/feature/Feature_list.vue @@ -394,7 +394,9 @@ export default { setTimeout( function () { - mapUtil.addVectorTileLayer(this.$route.params.slug,this.$store.state.feature_type.feature_types,this.form); + let project_id=this.$route.params.slug.split('-')[0]; + const mvtUrl = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}/features.mvt/?tile={z}/{x}/{y}&project_id=${project_id}`; + mapUtil.addVectorTileLayer(mvtUrl,this.$route.params.slug,this.$store.state.feature_type.feature_types,this.form); mapUtil.addGeocoders(this.$store.state.configuration); }.bind(this), 1000 diff --git a/src/views/project/Project_detail.vue b/src/views/project/Project_detail.vue index a0c54f08b882dfd604a93aa729bffa98aa3a3fbb..84888b12a4054e5fe90f51046cb8e55d1516b00c 100644 --- a/src/views/project/Project_detail.vue +++ b/src/views/project/Project_detail.vue @@ -648,7 +648,9 @@ export default { const url = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}projects/${this.$route.params.slug}/feature/?output=geojson`; let self = this; this.checkForOfflineFeature(); - mapUtil.addVectorTileLayer(this.$route.params.slug,this.$store.state.feature_type.feature_types); + let project_id=this.$route.params.slug.split('-')[0]; + const mvtUrl = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}/features.mvt/?tile={z}/{x}/{y}&project_id=${project_id}`; + mapUtil.addVectorTileLayer(mvtUrl,this.$route.params.slug,this.$store.state.feature_type.feature_types); axios .get(url) .then((response) => {