Skip to content

Commit

Permalink
fix: remove useLayoutEffect on Redirect page #26
Browse files Browse the repository at this point in the history
  • Loading branch information
luckylooky2 committed Sep 25, 2023
1 parent 3953fd6 commit d8b6c1f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/pages/Redirect.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import { useEffect, useLayoutEffect } from "react";
import { useEffect } from "react";
import { useNavigate } from "react-router";
import Loading from "@utils/Loading";
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");
}, []);
Expand Down

0 comments on commit d8b6c1f

Please sign in to comment.