Skip to content

Commit b8fe24f

Browse files
committed
feat: 로그인 시에만 my info 접근 가능하도록 조건 추가
1 parent aa13b4e commit b8fe24f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/pages/MyInfo.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { useNavigate } from "react-router-dom";
66
import TermsAndPrivacyModal from "@/components/modal/TermsAndPrivacyModal";
77
import { trackEvent } from "@/libs/analytics";
88
import { deleteUser } from "@/api/user";
9+
import Error from "@/pages/Error";
910

1011
type ModalType = "logout" | "withdraw" | "terms" | "privacy" | null;
1112

@@ -26,7 +27,7 @@ const alertConfig = {
2627

2728
const MyInfo = () => {
2829
const [modalType, setModalType] = useState<ModalType>(null);
29-
const { logout } = useAuthStore();
30+
const { logout, isLoggedIn } = useAuthStore();
3031
const navigate = useNavigate();
3132

3233
const handleCancel = () => {
@@ -60,12 +61,16 @@ const MyInfo = () => {
6061
};
6162

6263
const menuItems = [
63-
{ label: "이용약관", onClick: () => setModalType("terms") }, //TODO: 이용약관 팝업 구현 시 추가 필요
64-
{ label: "개인정보처리방침", onClick: () => setModalType("privacy") }, //TODO: 개인정보처리방침 팝업 구현 시 추가 필요
64+
{ label: "이용약관", onClick: () => setModalType("terms") },
65+
{ label: "개인정보처리방침", onClick: () => setModalType("privacy") },
6566
{ label: "로그아웃", onClick: () => setModalType("logout") },
6667
{ label: "회원탈퇴", onClick: () => setModalType("withdraw") }
6768
];
6869

70+
if (!isLoggedIn) {
71+
return <Error statusCode="401" />;
72+
}
73+
6974
return (
7075
<div className="relative flex w-[360px] flex-col bg-white md:w-[375px] lg:w-[500px]">
7176
<Header title="내 정보" showShareIcon={false} />

0 commit comments

Comments
 (0)