From 0546268969ca7309e17d952bbe7e0c62c82cfbb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=B5=E1=86=B7=E1=84=86=E1=85=B5=E1=86=AB?= =?UTF-8?q?=E1=84=80=E1=85=A7=E1=86=BC?= Date: Thu, 14 Dec 2023 22:09:58 +0900 Subject: [PATCH] =?UTF-8?q?Fix=20:=20=EC=86=8C=EC=85=9C=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20=EB=A6=AC=EB=8B=A4=EC=9D=B4=EB=A0=89=ED=8A=B8=20?= =?UTF-8?q?=EA=B3=BC=EC=A0=95=20=EB=B6=84=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/DefaultLayout.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/layout/DefaultLayout.tsx b/src/layout/DefaultLayout.tsx index b87d722..09c9d63 100644 --- a/src/layout/DefaultLayout.tsx +++ b/src/layout/DefaultLayout.tsx @@ -1,13 +1,14 @@ import { useEffect } from 'react'; -import { Outlet, useNavigate } from 'react-router'; +import { Outlet, useMatches, useNavigate } from 'react-router'; import styled from 'styled-components'; export default function DefaultLayout() { const isLogin = localStorage.getItem('token'); const navigate = useNavigate(); + const matches = useMatches(); useEffect(() => { - if (!isLogin) { + if (!isLogin && matches[1].pathname !== '/oauth') { navigate('/login'); } }, []);