2024-05-16 04:03:43 +05:30
|
|
|
"use client";
|
2024-05-17 14:27:49 +05:30
|
|
|
|
2024-06-20 14:08:52 +05:30
|
|
|
import { observer } from "mobx-react";
|
2024-05-14 14:26:54 +05:30
|
|
|
// components
|
2024-05-16 17:17:04 +05:30
|
|
|
import { UserLoggedIn } from "@/components/account";
|
2024-05-16 04:03:43 +05:30
|
|
|
import { LogoSpinner } from "@/components/common";
|
2024-05-14 14:26:54 +05:30
|
|
|
import { AuthView } from "@/components/views";
|
2024-05-16 04:03:43 +05:30
|
|
|
// hooks
|
|
|
|
|
import { useUser } from "@/hooks/store";
|
2024-05-14 14:26:54 +05:30
|
|
|
|
2024-05-23 14:27:16 +05:30
|
|
|
const HomePage = observer(() => {
|
2024-05-18 16:22:53 +05:30
|
|
|
const { data: currentUser, isAuthenticated, isLoading } = useUser();
|
2024-05-14 14:26:54 +05:30
|
|
|
|
2024-05-17 14:27:49 +05:30
|
|
|
if (isLoading) return <LogoSpinner />;
|
2024-05-16 04:03:43 +05:30
|
|
|
|
2024-05-17 14:27:49 +05:30
|
|
|
if (currentUser && isAuthenticated) return <UserLoggedIn />;
|
2024-05-14 14:26:54 +05:30
|
|
|
|
2024-05-15 02:25:38 +05:30
|
|
|
return <AuthView />;
|
2024-05-23 14:27:16 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default HomePage;
|