diff --git a/src/pages/settings/DeleteAccountPage.tsx b/src/pages/settings/DeleteAccountPage.tsx index 97e6b2d..64b9aa8 100644 --- a/src/pages/settings/DeleteAccountPage.tsx +++ b/src/pages/settings/DeleteAccountPage.tsx @@ -3,13 +3,16 @@ import React, { useState } from 'react'; import DeleteAccountModal from '@/pages/settings/components/DeleteAccountModal/DeleteAccountModal'; import { authApi } from '@/shared/apis/auth'; +import { SOCIAL_LOGIN_WITHDRAW_PASSWORD } from '@/shared/constants/authConstants'; +import { useAuth } from '@/shared/context/AuthContext'; import { tokenUtils } from '@/shared/utils/auth'; const DeleteAccountPage = () => { const [password, setPassword] = useState(''); const [isModalOpen, setIsModalOpen] = useState(false); + const { loginMethod } = useAuth(); - const isFormValid = password.trim() !== ''; + const isSocialLogin = loginMethod === 'kakao' || loginMethod === 'google'; const queryClient = useQueryClient(); const { mutate, isPending } = useMutation({ @@ -38,6 +41,8 @@ const DeleteAccountPage = () => { }, }); + const isFormValid = isSocialLogin || password.trim() !== ''; + const handleOpenModal: React.FormEventHandler = (e) => { e.preventDefault(); if (isFormValid) setIsModalOpen(true); @@ -48,7 +53,7 @@ const DeleteAccountPage = () => { }; const handleConfirmDelete = () => { - mutate(password); + mutate(isSocialLogin ? SOCIAL_LOGIN_WITHDRAW_PASSWORD : password); }; const handleCancelDelete = () => { @@ -65,20 +70,25 @@ const DeleteAccountPage = () => { onSubmit={handleOpenModal} className="mx-auto mt-8 w-full max-w-[432px] space-y-4 sm:mt-8 sm:space-y-6" > -
- - setPassword(e.target.value)} - autoComplete="current-password" - /> -
+ {!isSocialLogin && ( +
+ + setPassword(e.target.value)} + autoComplete="current-password" + /> +
+ )}