mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-10 20:57:14 +08:00
refactor: 优化 401 状态处理逻辑
1.退出接口增加登录校验 2.前端获取用户信息失败,自动清理客户端信息并跳转回登录页
This commit is contained in:
@@ -23,7 +23,7 @@ export default function setupUserLoginInfoGuard(router: Router) {
|
||||
await userStore.getInfo();
|
||||
next();
|
||||
} catch (error) {
|
||||
await userStore.logout();
|
||||
await userStore.logoutCallBack();
|
||||
next({
|
||||
name: 'login',
|
||||
query: {
|
||||
|
@@ -60,7 +60,7 @@ axios.interceptors.response.use(
|
||||
okText: '重新登录',
|
||||
async onOk() {
|
||||
const userStore = useUserStore();
|
||||
userStore.logout();
|
||||
userStore.logoutCallBack();
|
||||
window.location.reload();
|
||||
},
|
||||
});
|
||||
|
Reference in New Issue
Block a user