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

reload datas after route change on same view feature_details

parent ed6d3c66
No related branches found
No related tags found
No related merge requests found
......@@ -147,10 +147,13 @@
v-for="(link, index) in linked_features"
:key="link.feature_to.title + index"
>
<td>
<td v-if="link.feature_to.feature_type_slug">
{{ link.relation_type_display }}
<router-link
v-if="link.feature_to.feature_type_slug"
<a @click="pushNgo(link)">{{ link.feature_to.title }} </a>
({{ link.feature_to.display_creator }} -
{{ link.feature_to.created_on }})
<!-- <router-link
:key="$route.fullPath"
:to="{
name: 'details-signalement',
params: {
......@@ -162,6 +165,7 @@
>
({{ link.feature_to.display_creator }} -
{{ link.feature_to.created_on }})
-->
</td>
</tr>
</tbody>
......@@ -416,13 +420,31 @@ export default {
},
feature: function () {
return this.$store.state.feature.features.find(
const result = this.$store.state.feature.features.find(
(el) => el.feature_id === this.$route.params.slug_signal
);
console.log("result", result);
return result;
},
},
methods: {
pushNgo(link) {
this.$router.push({
name: "details-signalement",
params: {
slug_type_signal: link.feature_to.feature_type_slug,
slug_signal: link.feature_to.feature_id,
},
});
this.getFeatureEvents();
this.getFeatureAttachments();
this.getLinkedFeatures();
this.addFeatureToMap();
//this.initMap();
//this.$router.go();
},
postComment() {
featureAPI
.postComment({
......@@ -536,7 +558,12 @@ export default {
mapUtil.getMap().dragging.disable();
mapUtil.getMap().doubleClickZoom.disable();
mapUtil.getMap().scrollWheelZoom.disable();
var currentFeatureId = this.$route.params.slug_signal;
this.addFeatureToMap();
},
addFeatureToMap() {
const currentFeatureId = this.$route.params.slug_signal;
const url = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}features/${currentFeatureId}/?output=geojson`;
axios
.get(url)
......@@ -575,9 +602,9 @@ export default {
},
created() {
if (!this.project) {
this.$store.dispatch("GET_PROJECT_INFO", this.$route.params.slug);
}
// if (!this.project) {
// this.$store.dispatch("GET_PROJECT_INFO", this.$route.params.slug);
// }
this.$store.commit(
"feature_type/SET_CURRENT_FEATURE_TYPE_SLUG",
this.$route.params.slug_type_signal
......@@ -588,12 +615,16 @@ export default {
},
mounted() {
this.$store
.dispatch("GET_PROJECT_INFO", this.$route.params.slug)
.then((data) => {
console.log(data);
this.initMap();
});
if (!this.project) {
this.$store
.dispatch("GET_PROJECT_INFO", this.$route.params.slug)
.then((data) => {
console.log(data);
this.initMap();
});
} else {
this.initMap();
}
},
beforeDestroy() {
......
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