Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • geocontrib/geocontrib-frontend
  • ext_matthieu/geocontrib-frontend
  • fnecas/geocontrib-frontend
  • MatthieuE/geocontrib-frontend
4 results
Show changes
Commits on Source (4)
......@@ -162,14 +162,14 @@ export default new Vuex.Store({
},
USER_INFO({ state, commit }) {
if (state.user) {
if (!state.user) {
axios
.get(`${this.state.configuration.VUE_APP_DJANGO_API_BASE}user_info/`)
.then((response) => {
if (response && response.status === 200) {
const user = response.data.user;
commit("SET_USER", user);
window.localStorage.setItem("user", JSON.stringify(user)); //? toujours nécessaire ?
//window.localStorage.setItem("user", JSON.stringify(user)); // ? nécessaire ?
}
})
.catch(() => {
......@@ -178,16 +178,17 @@ export default new Vuex.Store({
}
},
LOGOUT({ commit }) {
const pageNoRedirect = ["liste-signalements", "details-type-signalement", "details-signalement", "project_detail", "mentions", "aide", "index"]
LOGOUT({ commit, dispatch }) {
// const pageNoRedirect = ["liste-signalements", "details-type-signalement", "details-signalement", "project_detail", "mentions", "aide", "index"]
axios
.get(`${this.state.configuration.VUE_APP_DJANGO_API_BASE}logout/`)
.then((response) => {
if (response && response.status === 200) {
commit("SET_USER", false);
commit("SET_USER_LEVEL_PROJECTS", null);
commit("SET_USER_PERMISSIONS", null);
if (!pageNoRedirect.includes(router.history.current.name)) router.push("/");
dispatch("GET_USER_LEVEL_PERMISSIONS");
// if (!pageNoRedirect.includes(router.history.current.name)) router.push("/");
router.push("/");
}
})
.catch((error) => {
......
......@@ -9,6 +9,16 @@
<p><i class="check icon"></i> {{ tempMessage }}</p>
</div>
</div>
<div id="message_info" class="fullwidth">
<div v-if="infoMessage" class="ui info message" style="text-align: left;">
<div class="header">
<i class="info circle icon"></i> Informations
</div>
<ul class="list">
{{ infoMessage }}
</ul>
</div>
</div>
<div class="row">
<div class="four wide middle aligned column">
......@@ -456,6 +466,7 @@ export default {
data() {
return {
infoMessage: '',
geojsonImport: [],
fileToImport: { name: "", size: 0 },
slug: this.$route.params.slug,
......@@ -517,7 +528,17 @@ export default {
suscribe: !this.is_suscriber,
projectSlug: this.$route.params.slug,
})
.then((data) => (this.is_suscriber = data.is_suscriber));
.then((data) => {
this.is_suscriber = data.is_suscriber;
this.isModalOpen = false;
if (this.is_suscriber)
this.infoMessage = 'Vous êtes maintenant abonné aux notifications de ce projet.';
else
this.infoMessage = "Vous ne recevrez plus les notifications de ce projet.";
setTimeout(function(){
this.infoMessage = '';
}.bind(this), 3000);
});
},
},
created() {
......@@ -530,7 +551,7 @@ export default {
},
mounted() {
if (this.project) {
if (this.project && this.permissions.can_view_project) {
this.$store.dispatch("map/INITIATE_MAP");
const url = `${this.$store.state.configuration.VUE_APP_DJANGO_API_BASE}projects/${this.$route.params.slug}/feature/?output=geojson`;
let self = this;
......