fix: delete_address not delete address_sender (#153)

This commit is contained in:
Dream Hunter
2024-04-22 20:51:55 +08:00
committed by GitHub
parent c92d7dee64
commit 90c8eff2e5
5 changed files with 12 additions and 4 deletions
+1
View File
@@ -8,6 +8,7 @@ on:
- main - main
tags: tags:
- "*" - "*"
workflow_dispatch:
jobs: jobs:
deploy: deploy:
+1 -1
View File
@@ -35,7 +35,7 @@ onMounted(async () => {
<template> <template>
<n-config-provider :locale="localeConfig" :theme="theme"> <n-config-provider :locale="localeConfig" :theme="theme">
<n-global-style /> <n-global-style />
<n-spin description="loading..." :show="loading"> <n-spin description="loading..." :show="loading" style="z-index: 9999;">
<n-message-provider> <n-message-provider>
<n-grid x-gap="12" :cols="12"> <n-grid x-gap="12" :cols="12">
<n-gi v-if="!isMobile" span="1"></n-gi> <n-gi v-if="!isMobile" span="1"></n-gi>
+2 -1
View File
@@ -81,6 +81,7 @@ const deleteEmail = async () => {
await fetchData() await fetchData()
} catch (error) { } catch (error) {
message.error(error.message || "error"); message.error(error.message || "error");
showDelteAccount.value = false
} }
} }
@@ -214,7 +215,7 @@ onMounted(async () => {
<template #action> <template #action>
</template> </template>
</n-modal> </n-modal>
<n-modal v-model:show="showDelteAccount" preset="dialog" title="Dialog"> <n-modal v-model:show="showDelteAccount" preset="dialog" :title="t('delteAccount')">
<p>{{ t('deleteTip') }}</p> <p>{{ t('deleteTip') }}</p>
<template #action> <template #action>
<n-button @click="deleteEmail" size="small" tertiary round type="error"> <n-button @click="deleteEmail" size="small" tertiary round type="error">
+4 -1
View File
@@ -66,8 +66,11 @@ api.delete('/admin/delete_address/:id', async (c) => {
if (!mailSuccess) { if (!mailSuccess) {
return c.text("Failed to delete mails", 500) return c.text("Failed to delete mails", 500)
} }
const { success: sendAccess } = await c.env.DB.prepare(
`DELETE FROM address_sender WHERE address_id = ? `
).bind(id).run();
return c.json({ return c.json({
success: success success: success && mailSuccess && sendAccess
}) })
}) })
+4 -1
View File
@@ -220,8 +220,11 @@ api.delete('/api/delete_address', async (c) => {
if (!mailSuccess) { if (!mailSuccess) {
return c.text("Failed to delete mails", 500) return c.text("Failed to delete mails", 500)
} }
const { success: sendAccess } = await c.env.DB.prepare(
`DELETE FROM address_sender WHERE address = ? `
).bind(address).run();
return c.json({ return c.json({
success: success success: success && mailSuccess && sendAccess
}) })
}) })