- authApi.withdraw(), 강한 경고 + 2차 확인 → DELETE /auth/me → 세션 정리·홈 이동 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -186,6 +186,29 @@ async function removePhoto() {
|
||||
function goEdit() {
|
||||
router.push('/settings/account/edit')
|
||||
}
|
||||
|
||||
// ===== 회원 탈퇴 =====
|
||||
const withdrawing = ref(false)
|
||||
async function withdraw() {
|
||||
if (withdrawing.value) return
|
||||
const ok = await dialog.confirm(
|
||||
'정말 탈퇴하시겠어요?\n\n· 계정과 모든 데이터(가계부·계좌·게시글·댓글·포인트·결제내역)가 영구 삭제됩니다.\n· 삭제된 데이터는 복구할 수 없습니다.',
|
||||
{ title: '회원 탈퇴', danger: true },
|
||||
)
|
||||
if (!ok) return
|
||||
const ok2 = await dialog.confirm('마지막 확인입니다. 정말 탈퇴를 진행할까요?', { title: '회원 탈퇴', danger: true })
|
||||
if (!ok2) return
|
||||
withdrawing.value = true
|
||||
try {
|
||||
await authApi.withdraw()
|
||||
await auth.clear()
|
||||
router.replace('/')
|
||||
dialog.alert('탈퇴가 완료되었습니다. 그동안 이용해 주셔서 감사합니다.')
|
||||
} catch (e) {
|
||||
withdrawing.value = false
|
||||
alert(e.response?.data?.message || '탈퇴에 실패했습니다. 잠시 후 다시 시도해 주세요.')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -336,6 +359,12 @@ function goEdit() {
|
||||
</Teleport>
|
||||
|
||||
<button type="button" class="primary-btn" @click="goEdit">이름 변경</button>
|
||||
|
||||
<div class="withdraw-area">
|
||||
<button type="button" class="withdraw-link" :disabled="withdrawing" @click="withdraw">
|
||||
{{ withdrawing ? '처리 중…' : '회원 탈퇴' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -729,6 +758,27 @@ function goEdit() {
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
}
|
||||
.withdraw-area {
|
||||
margin-top: 1.5rem;
|
||||
text-align: center;
|
||||
}
|
||||
.withdraw-link {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--color-text);
|
||||
opacity: 0.5;
|
||||
font-size: 0.85rem;
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
.withdraw-link:hover {
|
||||
color: #c0392b;
|
||||
opacity: 1;
|
||||
}
|
||||
.withdraw-link:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: default;
|
||||
}
|
||||
.primary-btn:hover {
|
||||
background: hsla(160, 100%, 32%, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user