Skip to content

Commit

Permalink
feat: 로그인 상태에 따라 mypage 리다이렉트
Browse files Browse the repository at this point in the history
  • Loading branch information
Byukchong committed Jul 17, 2024
1 parent 129c370 commit 7346860
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pages/mypage.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
import MyPageInput from '@/components/MyPageInput/MyPageInput';
import SidenNavigation from '@/components/SideNavigation/SideNavigation';
import SidenNavigationMobile from '@/components/SideNavigation/SideNavigationMobile';
import useLoginState from '@/hooks/useLoginState';
import { useSideNavigation } from '@/hooks/useSideNavigation';
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';
import { useEffect } from 'react';

export default function MyPage() {
const route = useRouter();
const { isLoggedIn } = useLoginState();
const { isOpen } = useSideNavigation();

useEffect(() => {
if (!isLoggedIn) {
route.push('/login');
}
}, [isLoggedIn, route]);

if (!isLoggedIn) {
return null;
}

return (
<>
<div
Expand Down

0 comments on commit 7346860

Please sign in to comment.