提交 98ff1060 authored 作者: lidongxu's avatar lidongxu

fix(request,permission): 修复:登录凭证过期后,点击重新登录按钮,不回调登录页面问题

上级 c74e29f2
...@@ -50,10 +50,7 @@ router.beforeEach((to, from, next) => { ...@@ -50,10 +50,7 @@ router.beforeEach((to, from, next) => {
}) })
}) })
}).catch(err => { }).catch(err => {
useUserStore().logOut().then(() => {
ElMessage.error(err) ElMessage.error(err)
next({ path: '/' })
})
}) })
} else { } else {
next() next()
......
...@@ -7,6 +7,7 @@ import cache from '@/plugins/cache' ...@@ -7,6 +7,7 @@ import cache from '@/plugins/cache'
import { saveAs } from 'file-saver' import { saveAs } from 'file-saver'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { fsClientAuth } from '@/api' import { fsClientAuth } from '@/api'
import router from '@/router'
let downloadLoadingInstance; let downloadLoadingInstance;
// 是否显示重新登录 // 是否显示重新登录
...@@ -106,7 +107,8 @@ service.interceptors.response.use(async res => { ...@@ -106,7 +107,8 @@ service.interceptors.response.use(async res => {
ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => { ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
isRelogin.show = false; isRelogin.show = false;
useUserStore().logOut().then(() => { useUserStore().logOut().then(() => {
location.href = '#/login'; // location.href = '#/login';
router.push({ path: '/login' })
}) })
}).catch(() => { }).catch(() => {
isRelogin.show = false; isRelogin.show = false;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论