Skip to content

Commit

Permalink
Fix : 소셜로그인 리다이렉트 과정 분기
Browse files Browse the repository at this point in the history
  • Loading branch information
sparrowscout committed Dec 14, 2023
1 parent 72725b9 commit 0546268
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/layout/DefaultLayout.tsx
Original file line number Diff line number Diff line change
@@ -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');
}
}, []);
Expand Down

0 comments on commit 0546268

Please sign in to comment.