plane/space/app/page.tsx

32 lines
838 B
TypeScript
Raw Normal View History

2024-05-12 13:45:10 +00:00
// components
2024-05-13 17:52:26 +00:00
import { UserLoggedIn } from "@/components/accounts";
2024-05-12 13:45:10 +00:00
import { AuthView } from "@/components/views";
// helpers
2024-05-13 17:52:26 +00:00
// import { EPageTypes } from "@/helpers/authentication.helper";
// import { useInstance, useUser } from "@/hooks/store";
2024-05-12 13:45:10 +00:00
// wrapper
2024-05-13 17:52:26 +00:00
// import { AuthWrapper } from "@/lib/wrappers";
// services
import { UserService } from "@/services/user.service";
2024-05-12 13:45:10 +00:00
2024-05-13 17:52:26 +00:00
const userServices = new UserService();
2024-05-12 13:45:10 +00:00
2024-05-13 17:52:26 +00:00
export default async function HomePage() {
const user = await userServices
.currentUser()
.then((user) => ({ ...user, isAuthenticated: true }))
.catch(() => ({ isAuthenticated: false }));
2024-05-12 13:45:10 +00:00
2024-05-13 17:52:26 +00:00
// const { data } = useInstance();
// console.log("data", data);
console.log("user", user);
if (user.isAuthenticated) {
return <UserLoggedIn />;
}
// return <>Login View</>;
return <AuthView />;
2024-05-12 13:45:10 +00:00
}