@@ -51,4 +51,8 @@ export const authApi = {
|
|||||||
profile() {
|
profile() {
|
||||||
return http.get('/auth/profile')
|
return http.get('/auth/profile')
|
||||||
},
|
},
|
||||||
|
// 회원 탈퇴 — 계정·데이터 전체 삭제
|
||||||
|
withdraw() {
|
||||||
|
return http.delete('/auth/me')
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,6 +186,29 @@ async function removePhoto() {
|
|||||||
function goEdit() {
|
function goEdit() {
|
||||||
router.push('/settings/account/edit')
|
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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -336,6 +359,12 @@ function goEdit() {
|
|||||||
</Teleport>
|
</Teleport>
|
||||||
|
|
||||||
<button type="button" class="primary-btn" @click="goEdit">이름 변경</button>
|
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -729,6 +758,27 @@ function goEdit() {
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
cursor: pointer;
|
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 {
|
.primary-btn:hover {
|
||||||
background: hsla(160, 100%, 32%, 1);
|
background: hsla(160, 100%, 32%, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user