2024-05-15 22:33:43 +00:00
|
|
|
"use client";
|
2024-05-17 08:57:49 +00:00
|
|
|
|
2024-05-14 08:56:54 +00:00
|
|
|
// components
|
2024-05-16 11:47:04 +00:00
|
|
|
import { UserLoggedIn } from "@/components/account";
|
2024-05-15 22:33:43 +00:00
|
|
|
import { LogoSpinner } from "@/components/common";
|
2024-05-14 08:56:54 +00:00
|
|
|
import { AuthView } from "@/components/views";
|
2024-05-15 22:33:43 +00:00
|
|
|
// hooks
|
|
|
|
import { useUser } from "@/hooks/store";
|
2024-05-14 08:56:54 +00:00
|
|
|
|
2024-05-18 10:52:53 +00:00
|
|
|
export default function HomePage() {
|
|
|
|
const { data: currentUser, isAuthenticated, isLoading } = useUser();
|
2024-05-14 08:56:54 +00:00
|
|
|
|
2024-05-17 08:57:49 +00:00
|
|
|
if (isLoading) return <LogoSpinner />;
|
2024-05-15 22:33:43 +00:00
|
|
|
|
2024-05-17 08:57:49 +00:00
|
|
|
if (currentUser && isAuthenticated) return <UserLoggedIn />;
|
2024-05-14 08:56:54 +00:00
|
|
|
|
2024-05-14 20:55:38 +00:00
|
|
|
return <AuthView />;
|
2024-05-14 08:56:54 +00:00
|
|
|
}
|