refactor: 优化 401 状态处理逻辑
1.退出接口增加登录校验 2.前端获取用户信息失败,自动清理客户端信息并跳转回登录页
This commit is contained in:
parent
d5da1847e3
commit
c70e28a535
@ -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();
|
||||
},
|
||||
});
|
||||
|
@ -110,7 +110,6 @@ public class AuthController {
|
||||
return LoginResp.builder().token(token).build();
|
||||
}
|
||||
|
||||
@SaIgnore
|
||||
@Operation(summary = "用户退出", description = "注销用户的当前登录")
|
||||
@Parameter(name = "Authorization", description = "令牌", required = true, example = "Bearer xxxx-xxxx-xxxx-xxxx",
|
||||
in = ParameterIn.HEADER)
|
||||
|
Loading…
Reference in New Issue
Block a user