优化用户注销功能及逻辑处理
This commit is contained in:
@ -5,14 +5,25 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import useUserStore from '~/stores/user'
|
||||
const userStore = useUserStore()
|
||||
import { userLogout } from '~/api/personal-center/index'
|
||||
const handleClick = () => {
|
||||
console.log('注销账号')
|
||||
ElMessageBox.confirm('确定注销账号吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}).then(() => {
|
||||
}).then(async () => {
|
||||
console.log('注销账号')
|
||||
const res = await userLogout()
|
||||
if (res.code === 0) {
|
||||
ElMessage.success('注销成功')
|
||||
navigateTo('/')
|
||||
clearNuxtState(['token', 'userInfo'])
|
||||
userStore.logout()
|
||||
userStore.$reset()
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user