inital working version
This commit is contained in:
27
frontend/src/app/page.tsx
Normal file
27
frontend/src/app/page.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
'use client';
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useAuth } from '../contexts/AuthContext';
|
||||
import LoadingSpinner from '../components/ui/LoadingSpinner';
|
||||
|
||||
export default function HomePage() {
|
||||
const { isAuthenticated, loading } = useAuth();
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
if (!loading) {
|
||||
if (isAuthenticated) {
|
||||
router.push('/library');
|
||||
} else {
|
||||
router.push('/login');
|
||||
}
|
||||
}
|
||||
}, [isAuthenticated, loading, router]);
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center theme-bg">
|
||||
<LoadingSpinner />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user