feat (login page): add a sign in / log in page
This commit is contained in:
@@ -2,16 +2,21 @@
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useSession } from "next-auth/react";
|
||||
import Sidebar from "@/components/Sidebar";
|
||||
|
||||
export default function AuthLayout({ children }: { children: React.ReactNode }) {
|
||||
const { status } = useSession();
|
||||
const router = useRouter();
|
||||
|
||||
useEffect(() => {
|
||||
if (sessionStorage.getItem("wyview_auth") !== "true") {
|
||||
if (status === "unauthenticated") {
|
||||
router.push("/");
|
||||
}
|
||||
}, [router]);
|
||||
}, [status, router]);
|
||||
|
||||
if (status === "loading") return null;
|
||||
if (status !== "authenticated") return null;
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen">
|
||||
|
||||
Reference in New Issue
Block a user