mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
Fixes reload of page on session expiry (#658)
Co-authored-by: Pearl Dsilva <pearl.dsilva@shapeblue.com> Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
60562b5f54
commit
60551aeac2
@ -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) {
|
||||
|
||||
@ -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' })
|
||||
}
|
||||
|
||||
|
||||
@ -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' })
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user