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

fix error project undefined and remove feature fetch

parent 202f5912
No related branches found
No related tags found
No related merge requests found
...@@ -191,7 +191,7 @@ import { mapUtil } from "@/assets/js/map-util.js"; ...@@ -191,7 +191,7 @@ import { mapUtil } from "@/assets/js/map-util.js";
import SidebarLayers from "@/components/map-layers/SidebarLayers"; import SidebarLayers from "@/components/map-layers/SidebarLayers";
import FeatureListTable from "@/components/feature/FeatureListTable"; import FeatureListTable from "@/components/feature/FeatureListTable";
import Dropdown from "@/components/Dropdown.vue"; import Dropdown from "@/components/Dropdown.vue";
import axios from '@/axios-client.js'; import axios from "@/axios-client.js";
// axios.defaults.headers.common['X-CSRFToken'] = (name => { // axios.defaults.headers.common['X-CSRFToken'] = (name => {
// var re = new RegExp(name + "=([^;]+)"); // var re = new RegExp(name + "=([^;]+)");
...@@ -280,7 +280,7 @@ export default { ...@@ -280,7 +280,7 @@ export default {
statusChoices() { statusChoices() {
//* if project is not moderate, remove pending status //* if project is not moderate, remove pending status
return this.form.status.choices.filter((el) => return this.form.status.choices.filter((el) =>
this.project.moderation ? true : el.value !== "pending" this.project && this.project.moderation ? true : el.value !== "pending"
); );
}, },
...@@ -293,17 +293,6 @@ export default { ...@@ -293,17 +293,6 @@ export default {
return pageNumb; return pageNumb;
}); });
}, },
/* displayedPageNumbers() {
return this.pageNumbers;
//return [...this.pageNumbers].splice(0, 4);
}, */
/* displayedPageEnd() {
return this.featuresCount <= this.pagination.end
? this.featuresCount
: this.pagination.end;
}, */
}, },
methods: { methods: {
...@@ -318,11 +307,9 @@ export default { ...@@ -318,11 +307,9 @@ export default {
.then(() => { .then(() => {
if (!this.modalAllDeleteOpen) { if (!this.modalAllDeleteOpen) {
this.$store this.$store
.dispatch("feature/GET_PROJECT_FEATURES", .dispatch("feature/GET_PROJECT_FEATURES", {
{ project_slug: this.project.slug,
project_slug: this.project.slug })
}
)
.then(() => { .then(() => {
this.updateFeatures(); this.updateFeatures();
this.checkedFeatures.splice(feature_id); this.checkedFeatures.splice(feature_id);
...@@ -343,7 +330,8 @@ export default { ...@@ -343,7 +330,8 @@ export default {
this.modalAllDelete(); this.modalAllDelete();
}, },
updateFeaturesOnMap() { onFilterChange() {
console.log("onFilterChange", this.featureGroup);
if (this.featureGroup) { if (this.featureGroup) {
const features = this.geojsonFeatures; const features = this.geojsonFeatures;
this.featureGroup.clearLayers(); this.featureGroup.clearLayers();
...@@ -370,13 +358,12 @@ export default { ...@@ -370,13 +358,12 @@ export default {
this.zoom = this.$route.query.zoom || ""; this.zoom = this.$route.query.zoom || "";
this.lat = this.$route.query.lat || ""; this.lat = this.$route.query.lat || "";
this.lng = this.$route.query.lng || ""; this.lng = this.$route.query.lng || "";
var mapDefaultViewCenter = var mapDefaultViewCenter =
this.$store.state.configuration.DEFAULT_MAP_VIEW.center; this.$store.state.configuration.DEFAULT_MAP_VIEW.center;
var mapDefaultViewZoom = var mapDefaultViewZoom =
this.$store.state.configuration.DEFAULT_MAP_VIEW.zoom; this.$store.state.configuration.DEFAULT_MAP_VIEW.zoom;
this.map = mapUtil.createMap(this.$refs.map, { this.map = mapUtil.createMap(this.$refs.map, {
zoom: this.zoom, zoom: this.zoom,
lat: this.lat, lat: this.lat,
...@@ -408,7 +395,7 @@ export default { ...@@ -408,7 +395,7 @@ export default {
}, },
handlePageChange(page) { handlePageChange(page) {
console.log("handlePageChange", page, typeof page) console.log("handlePageChange", page, typeof page);
if (page === "next") { if (page === "next") {
this.toNextPage(); this.toNextPage();
} else if (page === "previous") { } else if (page === "previous") {
...@@ -553,7 +540,7 @@ export default { ...@@ -553,7 +540,7 @@ export default {
this.geojsonFeatures = response.data.results.features; this.geojsonFeatures = response.data.results.features;
//if (response.data.results.features.length > 0) { //if (response.data.results.features.length > 0) {
this.loadFeatures(); this.loadFeatures();
this.updateFeaturesOnMap(); this.onFilterChange();
//} //}
} }
this.$store.commit("DISCARD_LOADER"); this.$store.commit("DISCARD_LOADER");
...@@ -597,32 +584,17 @@ export default { ...@@ -597,32 +584,17 @@ export default {
}, },
}, },
/* created() {
if (!this.project) {
this.$store.dispatch(
"GET_PROJECT_INFO",
this.$route.params.slug,
"noFeatures" //* not fetching classic features, too heavy, using paginated features instead
);
}
}, */
mounted() { mounted() {
if (!this.project) { if (!this.project) {
// Chargements des features et infos projet en cas d'arrivée directe sur la page ou de refresh // Chargements des features et infos projet en cas d'arrivée directe sur la page ou de refresh
axios.all([ this.$store
this.$store.dispatch("GET_PROJECT_INFO", this.$route.params.slug), .dispatch("GET_PROJECT_INFO", this.$route.params.slug)
this.$store.dispatch('feature/GET_PROJECT_FEATURES', {
project_slug: this.$route.params.slug
})])
.then(() => { .then(() => {
this.initMap(); this.initMap();
}); });
} } else {
else {
this.initMap(); this.initMap();
} }
}, },
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