// 路由守卫:未登录跳 /login,回跳记录来源路径 import { type ReactNode } from 'react'; import { Navigate, useLocation } from 'react-router-dom'; import { isAuthenticated } from '../auth/token'; export function RequireAuth({ children }: { children: ReactNode }) { const location = useLocation(); if (!isAuthenticated()) { return ; } return <>{children}; }