Skip to content

Commit

Permalink
fix: PrivateRoute -> RequireAuthRoute
Browse files Browse the repository at this point in the history
  • Loading branch information
jhsung23 committed Oct 13, 2024
1 parent 179891e commit 59451c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Props = {
* @description 로그인이 필요한 페이지를 래핑하는 컴포넌트.
* 로그인 여부 확인 후, 로그인했다면 래핑한 페이지를 렌더하고 로그인하지 않았다면 로그인 페이지로 리다이렉트함
*/
export const PrivateRoute = ({ children }: Props) => {
export const RequireAuthRoute = ({ children }: Props) => {
const { pathname, state } = useLocation();
const { isAuthenticated } = useAuth();
const isAccessAllowed = state === 'allow'; // NOTE: accessToken이 없어도 예외적으로 접근을 허용할 때 사용 (e.g. 비회원으로 일정 입력하기)
Expand Down
14 changes: 7 additions & 7 deletions src/routes/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { PinRelease } from '@/pages/PinRelease';
import { TimeCollection } from '@/pages/TimeCollection';
import { TotalSchedule } from '@/pages/TotalSchedule';

import { PrivateRoute } from './PrivateRoute';
import { RequireAuthRoute } from './RequireAuthRoute';

export const router = createBrowserRouter([
{
Expand All @@ -42,17 +42,17 @@ export const router = createBrowserRouter([
index: true,
// loader: meetingLoader, FIXME: 로그인하지 않은 경우 권한을 필요로하는 로더 동작 불가능하므로 제거하기
element: (
<PrivateRoute>
<RequireAuthRoute>
<Meeting />
</PrivateRoute>
</RequireAuthRoute>
),
},
{
path: 'new',
element: (
<PrivateRoute>
<RequireAuthRoute>
<NewMeeting />
</PrivateRoute>
</RequireAuthRoute>
),
},
{
Expand All @@ -72,9 +72,9 @@ export const router = createBrowserRouter([
{
path: 'new',
element: (
<PrivateRoute>
<RequireAuthRoute>
<NewSchedule />
</PrivateRoute>
</RequireAuthRoute>
),
},
{
Expand Down

0 comments on commit 59451c6

Please sign in to comment.