Skip to content

Commit

Permalink
feat: 특정 페이지에서 로그인 여부 판단하는 기능 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyoeunkh committed Jul 4, 2024
1 parent 2f6e070 commit ce87806
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/utils/RequiredLogin.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Navigate, Outlet } from 'react-router-dom';

import { useAuth } from '@/hooks/useAuth';

export const RequiredLogin = () => {
const { authToken } = useAuth();
if (!authToken) {
return <Navigate to="/login" replace={true} />;
}
return <Outlet />;
};

0 comments on commit ce87806

Please sign in to comment.