Skip to content
Snippets Groups Projects
Commit 185344c8 authored by Timothee P's avatar Timothee P :sunflower:
Browse files

fix unexisting feature at creation not prevented

parent f50eba40
No related branches found
No related tags found
No related merge requests found
...@@ -267,7 +267,7 @@ import featureAPI from "@/services/feature-api"; ...@@ -267,7 +267,7 @@ import featureAPI from "@/services/feature-api";
import L from "leaflet"; import L from "leaflet";
import "leaflet-draw"; import "leaflet-draw";
import { mapUtil } from "@/assets/js/map-util.js"; import { mapUtil } from "@/assets/js/map-util.js";
import axios from '@/axios-client.js'; import axios from "@/axios-client.js";
import flip from "@turf/flip"; import flip from "@turf/flip";
// axios.defaults.headers.common["X-CSRFToken"] = ((name) => { // axios.defaults.headers.common["X-CSRFToken"] = ((name) => {
...@@ -367,9 +367,8 @@ export default { ...@@ -367,9 +367,8 @@ export default {
return this.$route.name; return this.$route.name;
}, },
feature: function () { feature () {
const result = this.$store.state.feature.current_feature; return this.$store.state.feature.current_feature;
return result;
}, },
orderedCustomFields() { orderedCustomFields() {
...@@ -1008,25 +1007,31 @@ export default { ...@@ -1008,25 +1007,31 @@ export default {
}, },
mounted() { mounted() {
axios.all([this.$store let promises = [
.dispatch("GET_PROJECT_INFO", this.$route.params.slug), this.$store.dispatch("GET_PROJECT_INFO", this.$route.params.slug),
this.$store.dispatch('feature/GET_PROJECT_FEATURE', { ];
project_slug: this.$route.params.slug, if (this.$route.params.slug_signal) {
feature_id: this.$route.params.slug_signal promises.push(
})]) this.$store.dispatch("feature/GET_PROJECT_FEATURE", {
.then(() => { project_slug: this.$route.params.slug,
this.initForm(); feature_id: this.$route.params.slug_signal,
this.initMap(); })
this.onFeatureTypeLoaded(); );
this.initExtraForms(this.feature); }
setTimeout( Promise.all(promises).then(() => {
function () { this.initForm();
mapUtil.addGeocoders(this.$store.state.configuration); this.initMap();
}.bind(this), this.onFeatureTypeLoaded();
1000 if (this.feature) this.initExtraForms(this.feature);
);
}); setTimeout(
function () {
mapUtil.addGeocoders(this.$store.state.configuration);
}.bind(this),
1000
);
});
}, },
destroyed() { destroyed() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment