diff --git a/canapGEST/Site/src/App.vue b/canapGEST/Site/src/App.vue index ba51bbc6f0a355431d72ab70231bdc6fc8cc491d..0398ac33a3056887baeb1e1f0a1d6b9e008889b2 100644 --- a/canapGEST/Site/src/App.vue +++ b/canapGEST/Site/src/App.vue @@ -19,7 +19,7 @@ import MainFooter from '@/layouts/MainFooter.vue' import alertSnackbar from '@/components/alertSnackbar.vue' export default { - created() { + created () { let key = null if (location.hash !== '#/') { key = location.hash.replace('#/?key=', '') @@ -29,6 +29,8 @@ export default { } if (!this.$store.getters['moduleUser/userIsLogedIn']) { this.$store.dispatch('moduleUser/login', key) + } else { + this.$store.dispatch('moduleUser/getLastConnection') } }, components: { diff --git a/canapGEST/Site/src/store/modules/user/actions.js b/canapGEST/Site/src/store/modules/user/actions.js index b44d0bdf5056ac3acbcb61f2f2efd1fc0a520734..7c37f2625bdf992c809051f56d90181fb3db34e4 100644 --- a/canapGEST/Site/src/store/modules/user/actions.js +++ b/canapGEST/Site/src/store/modules/user/actions.js @@ -15,20 +15,12 @@ export function login (context, key) { export function logout (context, fullLogout) { localStorage.removeItem('stored_token') if (fullLogout) { - // set last conn ? - window.location = 'https://tequila.epfl.ch/logout' + setLastConnection().then(() => { + window.location = 'https://tequila.epfl.ch/logout' + }) } else { location.reload() } - // setLastConnection().then(() => { - // console.log('test') - // localStorage.removeItem('stored_token') - // if (fullLogout) { - // window.location = 'https://tequila.epfl.ch/logout' - // } else { - // location.reload() - // } - // }) } export function getUserData (context) { diff --git a/canapGEST/Site/src/store/modules/user/mutations.js b/canapGEST/Site/src/store/modules/user/mutations.js index a15c49d46f76cabad3231b16e1341b85b98a4029..ace89d324541ebdd1b4430bf6ee77a1e507fa0c7 100644 --- a/canapGEST/Site/src/store/modules/user/mutations.js +++ b/canapGEST/Site/src/store/modules/user/mutations.js @@ -1,11 +1,11 @@ -export function setUserData(state, data) { +export function setUserData (state, data) { state.userData = data } -export function setPermittedJobs(state, data) { +export function setPermittedJobs (state, data) { state.permittedJobs = data } -export function setLastConnection(state, data) { +export function setLastConnection (state, data) { state.lastConnection = data } \ No newline at end of file