生产管理系统 loading页面美化
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
'use client';
|
||||
|
||||
import "@/styles/globals.css"
|
||||
import { useEffect } from 'react';
|
||||
import { AuthProvider } from '@/components/auth/AuthContext';
|
||||
import { ClientAuthInterceptor } from '@/components/auth/ClientAuthInterceptor';
|
||||
|
||||
@@ -1,30 +1,10 @@
|
||||
|
||||
'use client';
|
||||
|
||||
import { useAuth } from '@/components/auth/AuthContext';
|
||||
import { LoadingScreen } from '@/components/auth/LoadingScreen';
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
export default function HomePage() {
|
||||
const { user, loading, isAuthenticated } = useAuth();
|
||||
|
||||
// 如果正在加载,显示加载屏幕
|
||||
if (loading) {
|
||||
return <LoadingScreen />;
|
||||
}
|
||||
console.log('isAuthenticated:',isAuthenticated)
|
||||
// 如果未认证,重定向到登录页
|
||||
if (!isAuthenticated) {
|
||||
redirect('/login');
|
||||
}
|
||||
|
||||
// 如果已认证,重定向到个人中心
|
||||
if (isAuthenticated) {
|
||||
redirect('/central-config/personal-center/personal-info');
|
||||
}
|
||||
|
||||
// 兜底显示(一般不会执行到这里)
|
||||
return (
|
||||
<div></div>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user