27 lines
611 B
TypeScript
27 lines
611 B
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
import { useRouter } from "next/navigation";
|
|
import { useAuth } from "@/hooks/use-auth";
|
|
|
|
export default function Home() {
|
|
const { user, isLoading } = useAuth();
|
|
const router = useRouter();
|
|
|
|
useEffect(() => {
|
|
if (!isLoading) {
|
|
if (user) {
|
|
router.replace("/dashboard");
|
|
} else {
|
|
router.replace("/login");
|
|
}
|
|
}
|
|
}, [user, isLoading, router]);
|
|
|
|
return (
|
|
<div className="flex min-h-screen items-center justify-center">
|
|
<div className="animate-pulse text-muted-foreground">Laden...</div>
|
|
</div>
|
|
);
|
|
}
|