From d8b6c1f21d10e9e1f61ac5ab802e748ca1d75872 Mon Sep 17 00:00:00 2001 From: luckylooky2 Date: Mon, 25 Sep 2023 13:05:04 +0900 Subject: [PATCH] fix: remove useLayoutEffect on Redirect page #26 --- src/pages/Redirect.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pages/Redirect.tsx b/src/pages/Redirect.tsx index c84265e..5b7eab2 100644 --- a/src/pages/Redirect.tsx +++ b/src/pages/Redirect.tsx @@ -1,4 +1,4 @@ -import { useEffect, useLayoutEffect } from "react"; +import { useEffect } from "react"; import { useNavigate } from "react-router"; import Loading from "@utils/Loading"; import { getCookie } from "@utils/getCookie"; @@ -6,15 +6,12 @@ import { getCookie } from "@utils/getCookie"; const Redirect = () => { const navigate = useNavigate(); - useLayoutEffect(() => { + useEffect(() => { const cookie = getCookie("at"); - if (!cookie) { alert("로그인 정보가 유효하지 않습니다. 다시 로그인 해주세요."); + navigate("/"); } - }, []); - - useEffect(() => { localStorage.setItem("isLogin", "true"); navigate("/main"); }, []);