From 5ca69c7eb0c3914e45f4ad5fbe544c5ae8239131 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Poussard?= <tpoussard@neogeo.fr>
Date: Tue, 5 Oct 2021 10:23:42 +0200
Subject: [PATCH] fix map container not found & use existing getter for
 feature_type instead of another function

---
 src/views/feature/Feature_edit.vue | 26 ++------------------------
 1 file changed, 2 insertions(+), 24 deletions(-)

diff --git a/src/views/feature/Feature_edit.vue b/src/views/feature/Feature_edit.vue
index 74ee78c9..bf455ac4 100644
--- a/src/views/feature/Feature_edit.vue
+++ b/src/views/feature/Feature_edit.vue
@@ -271,7 +271,6 @@ export default {
   data() {
     return {
       map: null,
-      feature_type: null,
       baseUrl: this.$store.state.configuration.BASE_URL,
       file: null,
       showGeoRef: false,
@@ -336,6 +335,7 @@ export default {
 
   computed: {
     ...mapGetters(["project"]),
+    ...mapGetters("feature_type", ["feature_type"]),
     ...mapState(["user", "USER_LEVEL_PROJECTS"]),
     ...mapState("map", ["basemaps"]),
     ...mapState("feature", [
@@ -415,15 +415,6 @@ export default {
     },
   },
 
-  /*   watch: {
-    feature(newValue) {
-      if (this.$route.name === "editer-signalement") {
-        this.initForm();
-        this.initExtraForms(newValue);
-      }
-    },
-  }, */
-
   methods: {
     initForm() {
       if (this.currentRouteName === "editer-signalement") {
@@ -875,7 +866,7 @@ export default {
       });
       const currentFeatureId = this.$route.params.slug_signal;
 
-      const url = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}projects/${this.$route.params.slug}/feature/?feature_type__slug=${this.feature_type.slug}&output=geojson`;
+      const url = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}projects/${this.$route.params.slug}/feature/?feature_type__slug=${this.$route.params.slug_type_signal}&output=geojson`;
       axios
         .get(url)
         .then((response) => {
@@ -932,14 +923,6 @@ export default {
   },
 
   created() {
-    //if (!this.project) {
-    //console.log(this.$store.state.projects);
-    /* this.project = this.$store.state.projects.find(
-        (project) => project.slug === this.$store.state.project_slug
-      ); */
-    //this.filterStatusChoicesF();
-    //}
-
     this.$store.commit(
       "feature_type/SET_CURRENT_FEATURE_TYPE_SLUG",
       this.$route.params.slug_type_signal
@@ -952,17 +935,12 @@ export default {
   },
 
   mounted() {
-    let ftSlug = this.$route.params.slug_type_signal;
     this.$store
       .dispatch("GET_PROJECT_INFO", this.$route.params.slug)
       .then((data) => {
         console.log(data);
         this.initForm();
         this.initMap();
-        console.log(this.$store.state.feature_type.feature_types);
-        this.feature_type = this.$store.state.feature_type.feature_types.find(
-          (el) => el.slug === ftSlug
-        );
         this.onFeatureTypeLoaded();
         this.initExtraForms();
 
-- 
GitLab