This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git
The following commit(s) were added to refs/heads/master by this push:
new a6b20c5 Fixes reload of page on session expiry (#658)
a6b20c5 is described below
commit a6b20c5e3ea11eab267f91d5666a267205b3b3f0
Author: Pearl Dsilva <[email protected]>
AuthorDate: Wed Sep 16 14:48:38 2020 +0530
Fixes reload of page on session expiry (#658)
Co-authored-by: Pearl Dsilva <[email protected]>
---
src/utils/request.js | 6 ++----
src/views/AutogenView.vue | 9 ++++++++-
src/views/iam/DomainView.vue | 9 ++++++++-
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/utils/request.js b/src/utils/request.js
index 0abd090..ffc62eb 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -18,11 +18,11 @@
import Vue from 'vue'
import axios from 'axios'
import router from '@/router'
-import store from '@/store'
import { VueAxios } from './axios'
import notification from 'ant-design-vue/es/notification'
import { CURRENT_PROJECT } from '@/store/mutation-types'
import i18n from '@/locales'
+import store from '@/store'
const service = axios.create({
timeout: 600000
@@ -46,9 +46,7 @@ const err = (error) => {
key: 'http-401'
})
store.dispatch('Logout').then(() => {
- setTimeout(() => {
- window.location.reload()
- }, 1500)
+ router.go(0)
})
}
if (response.status === 404) {
diff --git a/src/views/AutogenView.vue b/src/views/AutogenView.vue
index d96833a..c2013ee 100644
--- a/src/views/AutogenView.vue
+++ b/src/views/AutogenView.vue
@@ -653,9 +653,16 @@ export default {
return
}
+ if ([401].includes(error.response.status)) {
+ store.dispatch('Logout').then(() => {
+ this.$router.push({ path: '/user/login', query: { redirect:
this.$route.fullPath } })
+ })
+ return
+ }
+
this.$notifyError(error)
- if ([401, 405].includes(error.response.status)) {
+ if ([405].includes(error.response.status)) {
this.$router.push({ path: '/exception/403' })
}
diff --git a/src/views/iam/DomainView.vue b/src/views/iam/DomainView.vue
index bb4efad..287ca56 100644
--- a/src/views/iam/DomainView.vue
+++ b/src/views/iam/DomainView.vue
@@ -181,7 +181,14 @@ export default {
duration: 0
})
- if ([401, 405].includes(error.response.status)) {
+ if ([401].includes(error.response.status)) {
+ store.dispatch('Logout').then(() => {
+ this.$router.push({ path: '/user/login', query: { redirect:
this.$route.fullPath } })
+ })
+ return
+ }
+
+ if ([405].includes(error.response.status)) {
this.$router.push({ path: '/exception/403' })
}