File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 1+ import { authInstance } from "@/api/axios" ;
2+
3+ export const deleteUser = async ( ) => {
4+ const response = await authInstance . delete ( "/api/users" ) ;
5+ return response . data ;
6+ } ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import useAuthStore from "@/store/useAuthStore";
55import { useNavigate } from "react-router-dom" ;
66import TermsAndPrivacyModal from "@/components/modal/TermsAndPrivacyModal" ;
77import { trackEvent } from "@/libs/analytics" ;
8+ import { deleteUser } from "@/api/user" ;
89
910type ModalType = "logout" | "withdraw" | "terms" | "privacy" | null ;
1011
@@ -32,7 +33,7 @@ const MyInfo = () => {
3233 setModalType ( null ) ;
3334 } ;
3435
35- const handleConfirm = ( ) => {
36+ const handleConfirm = async ( ) => {
3637 if ( modalType === "logout" ) {
3738 trackEvent ( "Click" , {
3839 page : "내 정보" ,
@@ -45,7 +46,15 @@ const MyInfo = () => {
4546 page : "내 정보" ,
4647 element : "회원탈퇴"
4748 } ) ;
48- console . log ( "회원탈퇴 실행" ) ; //TODO: 회원탈퇴 기능 구현 시 추가 필요
49+
50+ try {
51+ await deleteUser ( ) ;
52+ logout ( ) ;
53+ navigate ( "/" ) ;
54+ } catch ( error ) {
55+ console . error ( error ) ;
56+ navigate ( "/error" ) ;
57+ }
4958 }
5059 setModalType ( null ) ;
5160 } ;
You can’t perform that action at this time.
0 commit comments