diff --git a/src/store/index.js b/src/store/index.js index df23ac617d8949f73cefaedb30b23bb557d239c4..743b1431da014bb91434ae66fbe1eca1e14ffb4e 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -181,7 +181,7 @@ export default new Vuex.Store({ USER_EVENTS({ commit }) { return new Promise((resolve, reject) => { axios - .get(`${this.state.configuration.VUE_APP_DJANGO_API_BASE}events`) + .get(`${this.state.configuration.VUE_APP_DJANGO_API_BASE}events/`) .then((response) => { if (response && response.status === 200) { const events = response.data; diff --git a/src/views/feature/Feature_detail.vue b/src/views/feature/Feature_detail.vue index c20cb72cda4d07e4ce38d6bc4feaf87a428bf1f9..66892238a5562dec20c683ce3a47387cbfd99ce9 100644 --- a/src/views/feature/Feature_detail.vue +++ b/src/views/feature/Feature_detail.vue @@ -410,9 +410,7 @@ export default { data() { return { - isCanceling: false, attachments: [], - events: [], comment_form: { attachment_file: { errors: null, @@ -426,6 +424,9 @@ export default { value: null, }, }, + events: [], + isCanceling: false, + projectSlug: this.$route.params.slug, }; }, @@ -462,7 +463,7 @@ export default { isModerator() { return this.USER_LEVEL_PROJECTS && this.project && - this.USER_LEVEL_PROJECTS[this.project.slug] === 'Modérateur' + this.USER_LEVEL_PROJECTS[this.projectSlug] === 'Modérateur' ? true : false; }, diff --git a/src/views/feature/Feature_list.vue b/src/views/feature/Feature_list.vue index 8aea781df598b2b7c475045e7b4c48bdd6004e96..c841ce465f3f3b81d721f980e11074b211dbf1ea 100644 --- a/src/views/feature/Feature_list.vue +++ b/src/views/feature/Feature_list.vue @@ -257,6 +257,9 @@ export default { data() { return { + clickedFeatures: [], + currentLayer: null, + featuresCount: 0, form: { type: { selected: '', @@ -284,17 +287,13 @@ export default { }, title: null, }, - baseUrl: this.$store.state.configuration.BASE_URL, - clickedFeatures: [], - modalAllDeleteOpen: false, - mode: 'modify', - map: null, - zoom: null, lat: null, lng: null, - featuresCount: 0, + map: null, + modalAllDeleteOpen: false, + mode: 'modify', + next: null, paginatedFeatures: [], - currentLayer: null, pagination: { currentPage: 1, pagesize: 15, @@ -302,14 +301,15 @@ export default { end: 15, }, previous: null, - next: null, + projectSlug: this.$route.params.slug, + showMap: true, + showAddFeature: false, + showModifyStatus: false, sort: { column: '', ascending: true, }, - showMap: true, - showAddFeature: false, - showModifyStatus: false, + zoom: null, }; }, @@ -345,7 +345,7 @@ export default { availableStatus() { if (this.project) { const isModerate = this.project.moderation; - const userStatus = this.USER_LEVEL_PROJECTS[this.project.slug]; + const userStatus = this.USER_LEVEL_PROJECTS[this.projectSlug]; switch (userStatus) { case 'Administrateur projet' : //* ajout de 'pending' si projet modéré @@ -423,9 +423,9 @@ export default { mounted() { if (!this.project) { // Chargements des features et infos projet en cas d'arrivée directe sur la page ou de refresh - this.$store.dispatch('projects/GET_PROJECT', this.$route.params.slug); + this.$store.dispatch('projects/GET_PROJECT', this.projectSlug); this.$store - .dispatch('projects/GET_PROJECT_INFO', this.$route.params.slug) + .dispatch('projects/GET_PROJECT_INFO', this.projectSlug) .then(() => this.initMap()); } else { this.initMap(); @@ -477,7 +477,7 @@ export default { featureAPI.updateFeature({ feature_id, feature_type__slug: feature.feature_type, - project__slug: this.$route.params.slug, + project__slug: this.projectSlug, newStatus }).then((response) => { if (response && response.data && response.status === 200) { @@ -502,13 +502,13 @@ export default { }, deleteFeature(feature_id) { - const url = `${this.API_BASE_URL}features/${feature_id}/?project__slug=${this.project.slug}`; + const url = `${this.API_BASE_URL}features/${feature_id}/?project__slug=${this.projectSlug}`; axios //TODO: REFACTO -> Delete function already exist in store .delete(url, {}) .then(() => { if (!this.modalAllDeleteOpen) { this.GET_PROJECT_FEATURES({ - project_slug: this.$route.params.slug, + project_slug: this.projectSlug, }) .then(() => { this.fetchPagedFeatures(); @@ -569,11 +569,11 @@ export default { // --------- End sidebar events ---------- setTimeout(() => { - const project_id = this.$route.params.slug.split('-')[0]; + const project_id = this.projectSlug.split('-')[0]; const mvtUrl = `${this.API_BASE_URL}features.mvt/?tile={z}/{x}/{y}&project_id=${project_id}`; mapUtil.addVectorTileLayer( mvtUrl, - this.$route.params.slug, + this.projectSlug, this.feature_types, this.form ); @@ -583,7 +583,7 @@ export default { fetchBboxNfit(queryParams) { featureAPI - .getFeaturesBbox(this.project.slug, queryParams) + .getFeaturesBbox(this.projectSlug, queryParams) .then((bbox) => { if (bbox) { mapUtil.getMap().fitBounds(bbox, { padding: [25, 25] }); @@ -625,7 +625,7 @@ export default { fetchPagedFeatures(newUrl) { this.onFilterChange(); //* use paginated event to watch change in filters and modify features on map - let url = `${this.API_BASE_URL}projects/${this.$route.params.slug}/feature-paginated/?output=geojson&limit=${this.pagination.pagesize}&offset=${this.pagination.start}`; + let url = `${this.API_BASE_URL}projects/${this.projectSlug}/feature-paginated/?output=geojson&limit=${this.pagination.pagesize}&offset=${this.pagination.start}`; //* if receiving next & previous url if (newUrl && typeof newUrl === 'string') { //newUrl = newUrl.replace("8000", "8010"); //* for dev uncomment to use proxy link