Browse Source

refactor: isNeedLoginMode

feige996 8 tháng trước cách đây
mục cha
commit
d1b167bfcd
2 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 1 1
      src/router/config.ts
  2. 2 2
      src/router/interceptor.ts

+ 1 - 1
src/router/config.ts

@@ -4,7 +4,7 @@ export const LOGIN_STRATEGY_MAP = {
 }
 // 登录策略,默认使用`无需登录策略`,即默认不需要登录就可以访问
 export const LOGIN_STRATEGY = LOGIN_STRATEGY_MAP.DEFAULT_NO_NEED_LOGIN
-export const isNeedLogin = LOGIN_STRATEGY === LOGIN_STRATEGY_MAP.DEFAULT_NEED_LOGIN
+export const isNeedLoginMode = LOGIN_STRATEGY === LOGIN_STRATEGY_MAP.DEFAULT_NEED_LOGIN
 
 export const LOGIN_PAGE = '/pages/login/login'
 export const REGISTER_PAGE = '/pages/login/register'

+ 2 - 2
src/router/interceptor.ts

@@ -6,7 +6,7 @@
 import { useTokenStore } from '@/store/token'
 import { tabbarStore } from '@/tabbar/store'
 import { getLastPage, parseUrlToObj } from '@/utils/index'
-import { EXCLUDE_PAGE_LIST, isNeedLogin, LOGIN_PAGE, LOGIN_PAGE_LIST } from './config'
+import { EXCLUDE_PAGE_LIST, isNeedLoginMode, LOGIN_PAGE, LOGIN_PAGE_LIST } from './config'
 
 // 黑名单登录拦截器 - (适用于大部分页面不需要登录,少部分页面需要登录)
 export const navigateToInterceptor = {
@@ -49,7 +49,7 @@ export const navigateToInterceptor = {
     console.log('tokenStore.hasLogin:', tokenStore.hasLogin)
 
     // #region 1/2 需要登录的情况 ---------------------------
-    if (isNeedLogin) {
+    if (isNeedLoginMode) {
       if (tokenStore.hasLogin) {
         return
       }