From 0ad5ab88001569b2b9f4c816f421906491ab1b15 Mon Sep 17 00:00:00 2001 From: "SK\\ssssk" Date: Sun, 22 Sep 2024 02:52:47 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=ED=9A=8C=EC=9B=90=ED=83=88?= =?UTF-8?q?=ED=87=B4=20API=20=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/containers/mypage/MyProfileContainer.tsx | 24 +++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/containers/mypage/MyProfileContainer.tsx b/src/containers/mypage/MyProfileContainer.tsx index aa5b3e58..4f932036 100644 --- a/src/containers/mypage/MyProfileContainer.tsx +++ b/src/containers/mypage/MyProfileContainer.tsx @@ -2,6 +2,7 @@ import MyProfile from "@/components/mypage/MyProfile"; import useModalState from "@/hooks/useModalState"; +import useAuthStore from "@/store/authStore"; import useToastifyStore from "@/store/toastifyStore"; import { userResponseDto } from "@/types/UserDto"; import { fetchWithAuth } from "@/utils/fetchWithAuth"; @@ -20,6 +21,7 @@ const MyProfileContainer = ({userInfo}: IMyProfileContainer) => { const [userDeleteText, setUserDeleteText] = useState(""); const router = useRouter(); const toastifyStore = useToastifyStore(); + const authStore = useAuthStore(); const submitChangeNicknameHandler = async () => { if (nickname == "" && nickname == defaultNickname) return; @@ -50,28 +52,33 @@ const MyProfileContainer = ({userInfo}: IMyProfileContainer) => { } const userDeleteHandler = async () => { - - const response = await fetchWithAuth("/api/auth/user", { + const response = await fetchWithAuth(`/api/auth/user?type=${userInfo.provider}`, { method: "DELETE", "Content-Type": "application/json", }); if (response.ok) { - toastifyStore.setToastify({ + modalState.closeModal(); + await toastifyStore.setToastify({ type: "success", - message: "회원탈퇴에 성공했습니다." - }) - router.push("/"); + message: "회원탈퇴에 성공했습니다.", + }); + authStore.initialize(); + setTimeout(() => { + router.replace("/"); + }, 300); } - + else { toastifyStore.setToastify({ type: "error", message: "회원탈퇴에 실패했습니다.", }); + } } return ( + <> { changeUserDeleteText={changeUserDeleteText} userDeleteText={userDeleteText} userDeleteHandler={userDeleteHandler} - /> + /> + ); }; export default MyProfileContainer; From 1cf80e82cf2d6d42514c00b45d17508041115a7a Mon Sep 17 00:00:00 2001 From: "SK\\ssssk" Date: Sun, 22 Sep 2024 02:54:51 +0900 Subject: [PATCH 2/2] =?UTF-8?q?style:=20=ED=9A=8C=EC=9B=90=ED=83=88?= =?UTF-8?q?=ED=87=B4=20=EB=AC=B8=EA=B5=AC=20=EC=88=98=EC=A0=95=20=EB=B0=8F?= =?UTF-8?q?=20=EA=B0=84=EA=B2=A9=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/mypage/MyProfile.tsx | 44 ++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/src/components/mypage/MyProfile.tsx b/src/components/mypage/MyProfile.tsx index 61a5c104..d215bd53 100644 --- a/src/components/mypage/MyProfile.tsx +++ b/src/components/mypage/MyProfile.tsx @@ -38,7 +38,7 @@ const MyProfile = (props: IMyProfileProps) => { >
@@ -53,8 +53,9 @@ const MyProfile = (props: IMyProfileProps) => {

3. 필요한 정보는 회원탈퇴하기전에 따로 보관해주시기 바랍니다.

-
- {"'회원탈퇴를 하겠습니다.' 라고 입력해주세요."} +
+ '회원탈퇴를 하겠습니다.' + 라고 입력해주세요.
{ disabled={props.userDeleteText !== "회원탈퇴를 하겠습니다."} onClick={props.userDeleteHandler} className={ - "h-[3rem] w-full rounded-full bg-main text-white disabled:bg-gray2" + "h-[3rem] flex-shrink-0 w-full rounded-full bg-main text-white disabled:bg-gray2" } > 회원탈퇴
-
+
@@ -159,18 +160,30 @@ const MyProfile = (props: IMyProfileProps) => { 연동된 계정
- 카카오톡 + {props.userInfo.provider}
{props.userInfo.userImage.createdDate}
- {"kakao-icon-image"} + { + props.userInfo.provider == "kakao" && + {"kakao-icon-image"} + } + { + props.userInfo.provider == "google" && + {"google-icon-image"} + }
@@ -178,7 +191,12 @@ const MyProfile = (props: IMyProfileProps) => {
- +
);