refactor: ♻️ 存入localStorage移除前缀,websocket hook重构优化

This commit is contained in:
ray
2025-02-12 23:38:22 +08:00
parent 94c815eb58
commit 24057c3314
11 changed files with 247 additions and 190 deletions

View File

@@ -1,6 +1,6 @@
import type { NavigationGuardNext, RouteLocationNormalized, RouteRecordRaw } from "vue-router";
import NProgress from "@/utils/nprogress";
import { getToken } from "@/utils/auth";
import { getAccessToken } from "@/utils/auth";
import router from "@/router";
import { usePermissionStore, useUserStore } from "@/store";
@@ -11,7 +11,7 @@ export function setupPermission() {
router.beforeEach(async (to, from, next) => {
NProgress.start();
const isLogin = !!getToken(); // 判断是否登录
const isLogin = !!getAccessToken(); // 判断是否登录
if (isLogin) {
if (to.path === "/login") {
// 已登录,访问登录页,跳转到首页