refactor(auth): 权限判断与会话失效跳转收敛到 user store
- src/utils/auth: hasPerm 简化为纯权限判断,移除 redirectToLogin 与路由依赖 - src/directives/permission: v-hasPerm 复用 utils/auth 的 hasPerm - src/utils/request: token 失效改走 userStore.redirectToLogin - src/views/profile: 改密后重新登录改走 userStore.redirectToLogin
This commit is contained in:
1 parent
d136266acd
commit
cf5768dbf4
4 files changed
+16
-67
No files matched your search
@@ -314,7 +314,6 @@ import type { Component } from "vue";
|
||||
import { computed, onBeforeUnmount, onMounted, reactive, ref } from "vue";
|
||||
import FileAPI from "@/api/file";
|
||||
import { useUserStoreHook } from "@/stores";
|
||||
import { redirectToLogin } from "@/utils/auth";
|
||||
|
||||
import {
|
||||
Calendar,
|
||||
@@ -856,7 +855,7 @@ const handleSubmit = async () => {
|
||||
|
||||
await UserAPI.changePassword(passwordChangeForm);
|
||||
dialogState.visible = false;
|
||||
await redirectToLogin("密码已修改,请重新登录");
|
||||
await userStore.redirectToLogin("密码已修改,请重新登录");
|
||||
} else if (dialogState.type === DialogType.MOBILE) {
|
||||
const valid = await mobileBindingFormRef.value?.validate();
|
||||
if (!valid) return;
|
||||
|
||||
Reference in new issue
Block a user