diff --git a/src/bookmarks/ui/Main/BookmarkBSDeleteConfirmation.tsx b/src/bookmarks/ui/Main/BSDeleteConfirmation.tsx similarity index 79% rename from src/bookmarks/ui/Main/BookmarkBSDeleteConfirmation.tsx rename to src/bookmarks/ui/Main/BSDeleteConfirmation.tsx index b0001d03..06272534 100644 --- a/src/bookmarks/ui/Main/BookmarkBSDeleteConfirmation.tsx +++ b/src/bookmarks/ui/Main/BSDeleteConfirmation.tsx @@ -7,18 +7,24 @@ interface BSDeleteConfirmationProps { open: boolean; onClose: () => void; onDelete: () => void; + mainText?: string; + subText?: string; + buttonText?: string; } -const BookmarkBSDeleteConfirmation = ({ +const BSDeleteConfirmation = ({ open, onClose, onDelete, + mainText = '정말로 삭제 할까요?', + subText = '삭제하면 다시 복구할 수 없습니다. 삭제하시겠습니까?', + buttonText = '삭제', }: BSDeleteConfirmationProps) => { return ( - 정말로 삭제 할까요? + {mainText} - 삭제하면 다시 복구할 수 없습니다. 삭제하시겠습니까? + {subText} @@ -53,7 +59,7 @@ const BookmarkBSDeleteConfirmation = ({ ); }; -export default BookmarkBSDeleteConfirmation; +export default BSDeleteConfirmation; const BSWrapper = styled.div` display: flex; diff --git a/src/members/api/member.ts b/src/members/api/member.ts index f414f8e3..8687ec3e 100644 --- a/src/members/api/member.ts +++ b/src/members/api/member.ts @@ -526,3 +526,27 @@ export const useUnblockUserQuery = ({ }, }); }; + +interface DELETEUserInfoRequest { + loginId: number; + token?: string; +} + +const deleteUserInfoAPI = async ({ loginId, token }: DELETEUserInfoRequest) => { + const { data } = await client({ + method: 'delete', + url: '/members/me', + params: { loginId }, + data: {}, + headers: token ? { Authorization: `Bearer ${token}` } : {}, + }); + return data; +}; + +export interface DeleteAPIRequest { + loginId: number; + token?: string; +} +export const useDELETEUserInfoQuery = () => { + return useMutation(deleteUserInfoAPI); +}; diff --git a/src/pages/MainPage.tsx b/src/pages/MainPage.tsx index 545f1a13..e631e1cb 100644 --- a/src/pages/MainPage.tsx +++ b/src/pages/MainPage.tsx @@ -2,7 +2,7 @@ import styled from '@emotion/styled'; import BookmarkToggle from '@/bookmarks/ui/Main/BookmarkToggle'; import BookmarkUserInfo from '@/bookmarks/ui/BookmarkUserInfo'; -import BookmarkBSDeleteConfirmation from '@/bookmarks/ui/Main/BookmarkBSDeleteConfirmation'; +import BSDeleteConfirmation from '@/bookmarks/ui/Main/BSDeleteConfirmation'; import useCategory from '@/bookmarks/service/hooks/home/useCategory'; import useReadList from '@/bookmarks/service/hooks/home/useReadList'; import useDeleteBookmarkList from '@/bookmarks/service/hooks/home/useDeleteBookmarkList'; @@ -74,7 +74,7 @@ const MainPage = () => { {/** 북마크 삭제 확인 */} - { + const { + isOpen: deleteUserInfoBS, + open: openDeleteUserInfo, + close: closeDeleteUserInfo, + } = useBottomSheet(); + + const { memberId, initializeUserInfo } = useAuthStore(); + const { postMessage } = useWebview(); + const { mutate: deleteUserInfo } = useDELETEUserInfoQuery(); + const onClickDeleteUserInfo = () => { + deleteUserInfo({ loginId: memberId }); + initializeUserInfo(); + postMessage('signUp'); + }; + return (
@@ -56,6 +77,17 @@ const UserProfileInfo = ({ withCount /> + {mode === 'EDIT' && ( + + + 탈퇴하기 + + + )} {isEmojiBSOpen && } + {mode === 'EDIT' && ( + + )} ); }; @@ -87,3 +129,12 @@ const StyleEditBox = styled.div` flex-direction: column; padding: 0 ${getRem(20)}; `; + +const DeleteUserInfoWrapper = styled.div` + display: flex; + justify-content: flex-end; + margin-top: ${getRem(10)}; + padding-right: ${getRem(20)}; +`; + +const DeleteUserInfoText = styled(Text.Span)``;