diff --git a/app/mypage/_components/ScreenMyPage.tsx b/app/mypage/_components/ScreenMyPage.tsx index b65aff2..2887f65 100644 --- a/app/mypage/_components/ScreenMyPage.tsx +++ b/app/mypage/_components/ScreenMyPage.tsx @@ -1,7 +1,8 @@ "use client"; -import React, { useState, useEffect, useMemo } from "react"; +import React, { useState, useEffect, useMemo, useTransition } from "react"; import { BackButton } from "@/components/ui/BackButton"; +import { useRouter } from "next/navigation"; import Button from "@/components/ui/Button"; import ProfileButton from "@/app/profile-builder/_components/ProfileButton"; import ProfileImageSelection from "@/app/profile-image/_components/ProfileImageSelection"; @@ -39,6 +40,7 @@ import { NicknameAvailabilityResponse, } from "@/hooks/useNicknameAvailability"; import axios from "axios"; +import { withdrawAction } from "@/lib/actions/authAction"; /* ───── 상수 맵핑 ───── */ @@ -162,6 +164,7 @@ interface ScreenMyPageProps { } const ScreenMyPage = ({ initialProfile }: ScreenMyPageProps) => { + const router = useRouter(); // 서버에서 프로필 데이터 가져오기 const { data: profileResponse, isLoading, isError } = useMyProfile(); const { mutate: updateMyProfileMutate, isPending: isUpdating } = @@ -171,7 +174,8 @@ const ScreenMyPage = ({ initialProfile }: ScreenMyPageProps) => { isPending: isCheckingNickname, } = useNicknameAvailability(); - const isSubmitting = isUpdating || isCheckingNickname; + const [isWithdrawing, startWithdrawTransition] = useTransition(); + const isSubmitting = isUpdating || isCheckingNickname || isWithdrawing; const profile = profileResponse?.data; @@ -860,10 +864,23 @@ const ScreenMyPage = ({ initialProfile }: ScreenMyPageProps) => { {/* ── 탈퇴하기 ── */}