mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2025-12-12 10:52:48 +00:00
13 lines
411 B
TypeScript
13 lines
411 B
TypeScript
import { useLogin } from '@/hooks/useLogin'
|
|
import { getToken } from '@/utils/common'
|
|
import { getNeedLoginPages } from '@/utils/pages'
|
|
|
|
const loginBack = useLogin()
|
|
|
|
/**
|
|
* 检测是否需要登录
|
|
*/
|
|
export function checkNeedLogin(route: AnyObject){
|
|
const pages = getNeedLoginPages()
|
|
pages.includes(route.path) && !getToken() && loginBack.setLoginBack({ url: route.path, param: route.query || {} })
|
|
} |