feat: 开发采集、采集箱和商品编辑功能

This commit is contained in:
Joey
2026-08-15 22:17:26 +08:00
parent c61d1a3154
commit 36357843d0
130 changed files with 18005 additions and 12 deletions
+16
View File
@@ -0,0 +1,16 @@
import { useEffect } from 'react';
import { useNavigate } from 'react-router';
import { getToken } from '@/services/auth';
/** 未登录则跳 /login */
export default function RequireAuth({ children }: { children: React.ReactNode }) {
const navigate = useNavigate();
const token = getToken();
useEffect(() => {
if (!token) navigate('/login', { replace: true });
}, [token, navigate]);
if (!token) return null;
return <>{children}</>;
}