plane/space/app/page.tsx
guru_sainath bab52a2672
[WEB-1319] chore: New authentication workflow (#4481)
* chore: New authentication workflow

* chore: resolved build erros and updated imports in auth

* chore: code optimisation for query param util

* chore: added client for auth forms
2024-05-16 17:17:04 +05:30

28 lines
642 B
TypeScript

"use client";
import { observer } from "mobx-react-lite";
import useSWR from "swr";
// components
import { UserLoggedIn } from "@/components/account";
import { LogoSpinner } from "@/components/common";
import { AuthView } from "@/components/views";
// hooks
import { useUser } from "@/hooks/store";
function HomePage() {
const { fetchCurrentUser, isAuthenticated, isLoading } = useUser();
useSWR("CURRENT_USER", () => fetchCurrentUser(), { errorRetryCount: 0 });
if (isLoading) {
return <LogoSpinner />;
}
if (isAuthenticated) {
return <UserLoggedIn />;
}
return <AuthView />;
}
export default observer(HomePage);