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'); } }, []);