From 5f3179f46ca78095c9b2ad7165ed0f03110fa09d Mon Sep 17 00:00:00 2001 From: yowkah Date: Sat, 11 Dec 2021 06:15:19 +0100 Subject: [PATCH 1/2] Update App.vue Related to #50 . It seems that the Token is not always given with authentication. Absence of the token should not be valid reason to terminate or remove a perfectly good session. --- src/App.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/App.vue b/src/App.vue index ab73c97..36ef236 100644 --- a/src/App.vue +++ b/src/App.vue @@ -133,7 +133,7 @@ export default { this.$route.name !== 'login' && this.$route.name !== 'future-of-umi' && Object.keys(this.$store.state.auth).length > 0 && - (!this.$store.state.auth.token || !this.$store.state.auth.expires || new Date() > new Date(this.$store.state.auth.expires)) + (!this.$store.state.auth.expires || new Date() > new Date(this.$store.state.auth.expires)) ) { await this.$store.dispatch('logout', true) this.$router.replace(`/login?next=${encodeURIComponent(this.$route.fullPath)}`) From 47c94adcb58512962b1b022b7bfc7e2c065ba22b Mon Sep 17 00:00:00 2001 From: Zach Bruggeman Date: Mon, 10 Jan 2022 10:26:02 -0800 Subject: [PATCH 2/2] Use pre-existing token if new session data doesn't have it --- src/store/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/index.js b/src/store/index.js index 0353dad..415ae42 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -86,7 +86,7 @@ const store = new Vuex.Store({ commit('UPDATE_AUTH', { session_id: data.session_id, country: data.country_code.toLowerCase(), - token: data.auth, + token: data.auth || state.auth.token, expires: data.expires }) resolve()