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

fix static pages after redirection from login and redirect after logout only...

fix static pages after redirection from login and redirect after logout only for admin right restricted pages
parent 1ee4a4bb
No related branches found
No related tags found
1 merge request!34fix static pages after redirection from login and redirect after logout only...
...@@ -179,6 +179,7 @@ export default new Vuex.Store({ ...@@ -179,6 +179,7 @@ export default new Vuex.Store({
}, },
LOGOUT({ commit }) { LOGOUT({ commit }) {
const pageNoRedirect = ["liste-signalements", "details-type-signalement", "details-signalement", "project_detail", "mentions", "aide", "index"]
axios axios
.get(`${this.state.configuration.VUE_APP_DJANGO_API_BASE}logout/`) .get(`${this.state.configuration.VUE_APP_DJANGO_API_BASE}logout/`)
.then((response) => { .then((response) => {
...@@ -186,7 +187,7 @@ export default new Vuex.Store({ ...@@ -186,7 +187,7 @@ export default new Vuex.Store({
commit("SET_USER", false); commit("SET_USER", false);
commit("SET_USER_LEVEL_PROJECTS", null); commit("SET_USER_LEVEL_PROJECTS", null);
commit("SET_USER_PERMISSIONS", null); commit("SET_USER_PERMISSIONS", null);
router.push("/"); if (!pageNoRedirect.includes(router.history.current.name)) router.push("/");
} }
}) })
.catch((error) => { .catch((error) => {
......
<template> <template>
<div v-if="flatpage" class="row"> <div v-if="flatpage" class="row">
<div class="ten wide column"> <div class="ten wide column">
{{ this.$route.params.url }}
<h1>{{ flatpage.title }}</h1> <h1>{{ flatpage.title }}</h1>
<div v-html="flatpage.content"></div> <div v-html="flatpage.content"></div>
</div> </div>
...@@ -9,13 +8,17 @@ ...@@ -9,13 +8,17 @@
</template> </template>
<script> <script>
import { mapState } from "vuex";
export default { export default {
name: "Default", name: "Default",
computed: { computed: {
...mapState(["staticPages"]),
flatpage() { flatpage() {
if (this.$store.state.staticPages) { if (this.staticPages) {
return this.$store.state.staticPages.find( return this.staticPages.find(
(page) => page.url === this.$route.path (page) => page.url === `/${this.$route.name}/`
); );
} }
return null; return null;
......
...@@ -23,18 +23,23 @@ ...@@ -23,18 +23,23 @@
</template> </template>
<script> <script>
import { mapState } from "vuex";
export default { export default {
name: "With_right_menu", name: "With_right_menu",
data() { data() {
return { return {
sections: [], sections: [],
}; };
}, },
computed: { computed: {
...mapState(["staticPages"]),
flatpage() { flatpage() {
if (this.$store.state.staticPages) { if (this.staticPages) {
return this.$store.state.staticPages.find( return this.staticPages.find(
(page) => page.url === this.$route.path (page) => page.url === `/${this.$route.name}/`
); );
} }
return null; return null;
......
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