mirror of
https://gitee.com/niucloud-team/niucloud.git
synced 2025-12-13 02:02:47 +00:00
17 lines
476 B
TypeScript
17 lines
476 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()
|
|
if (pages.includes(route.path) && !getToken()) {
|
|
setTimeout(() => {
|
|
loginBack.setLoginBack({ url: route.path, param: route.query || {} })
|
|
}, 100)
|
|
}
|
|
} |