Mercurial > gemma
comparison client/src/components/Sidebar.vue @ 1701:f4bd67daaaff
feat: force login on invalid session
Redirect user to login when session becomes invalid.
Prototypical implementation for importqueue.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Mon, 07 Jan 2019 12:13:52 +0100 |
parents | 90211725e4a9 |
children | b24a54c684bd |
comparison
equal
deleted
inserted
replaced
1700:0c0e658fcfc8 | 1701:f4bd67daaaff |
---|---|
134 * Author(s): | 134 * Author(s): |
135 * Thomas Junk <thomas.junk@intevation.de> | 135 * Thomas Junk <thomas.junk@intevation.de> |
136 * Markus Kottländer <markus.kottlaender@intevation.de> | 136 * Markus Kottländer <markus.kottlaender@intevation.de> |
137 */ | 137 */ |
138 import { mapGetters, mapState } from "vuex"; | 138 import { mapGetters, mapState } from "vuex"; |
139 import app from "@/main"; | 139 import { logOff } from "@/lib/session.js"; |
140 | 140 |
141 export default { | 141 export default { |
142 name: "sidebar", | 142 name: "sidebar", |
143 props: ["routeName"], | 143 props: ["routeName"], |
144 watch: { | 144 watch: { |
173 }, | 173 }, |
174 IMPORTSCHEDULE: process.env.VUE_APP_FEATURE_IMPORTSCHEDULE, | 174 IMPORTSCHEDULE: process.env.VUE_APP_FEATURE_IMPORTSCHEDULE, |
175 IMPORTSTRETCHES: process.env.VUE_APP_FEATURE_IMPORTSTRETCHES, | 175 IMPORTSTRETCHES: process.env.VUE_APP_FEATURE_IMPORTSTRETCHES, |
176 methods: { | 176 methods: { |
177 logoff() { | 177 logoff() { |
178 app.$snotify.clear(); | 178 logOff(); |
179 this.$store.commit("reset"); | |
180 this.$store.commit("user/clearAuth"); | |
181 this.$router.push("/login"); | |
182 }, | 179 }, |
183 toggleContextBox(context) { | 180 toggleContextBox(context) { |
184 if (this.$route.path !== "/") this.$router.push("/"); | 181 if (this.$route.path !== "/") this.$router.push("/"); |
185 this.$store.commit("application/showContextBox", true); | 182 this.$store.commit("application/showContextBox", true); |
186 this.$store.commit("application/contextBoxContent", context); | 183 this.$store.commit("application/contextBoxContent", context); |