We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 09d63a8 commit 491a484Copy full SHA for 491a484
pages/login/index.tsx
@@ -4,6 +4,9 @@ import SnsLogin from "@/components/Auth/SnsLogin";
4
import SubmitButton from "@/components/SubMitButton";
5
import AuthLayout from "@/components/Layout/AuthLayout";
6
import Link from "next/link";
7
+import { useRouter } from "next/router";
8
+import useAuthStore from "@/store/useAuthStore";
9
+import { useEffect } from "react";
10
11
const LoginPage = () => {
12
const {
@@ -15,6 +18,14 @@ const LoginPage = () => {
15
18
isFormInvalid,
16
19
isLoading,
17
20
} = useForm(false);
21
+ const router = useRouter();
22
+ const { user } = useAuthStore();
23
+
24
+ useEffect(() => {
25
+ if (user) {
26
+ router.replace("/");
27
+ }
28
+ }, [user, router]);
29
30
return (
31
<div className="bg-gray100 min-h-screen">
0 commit comments