From 8c70bbe74da740e1a252a6a2060c46960d6b3ac8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 5 May 2023 08:47:02 +0900 Subject: [PATCH] :art: --- .../{account-info.vue => account-stats.vue} | 14 +-- .../src/pages/settings/delete-account.vue | 52 ----------- .../frontend/src/pages/settings/other.vue | 86 ++++++++++++++++--- packages/frontend/src/router.ts | 10 +-- 4 files changed, 76 insertions(+), 86 deletions(-) rename packages/frontend/src/pages/settings/{account-info.vue => account-stats.vue} (94%) delete mode 100644 packages/frontend/src/pages/settings/delete-account.vue diff --git a/packages/frontend/src/pages/settings/account-info.vue b/packages/frontend/src/pages/settings/account-stats.vue similarity index 94% rename from packages/frontend/src/pages/settings/account-info.vue rename to packages/frontend/src/pages/settings/account-stats.vue index 584808b0b4..a0f1541b40 100644 --- a/packages/frontend/src/pages/settings/account-info.vue +++ b/packages/frontend/src/pages/settings/account-stats.vue @@ -1,18 +1,6 @@ @@ -34,9 +63,12 @@ import { computed, watch } from 'vue'; import MkSwitch from '@/components/MkSwitch.vue'; import FormLink from '@/components/form/link.vue'; import MkFolder from '@/components/MkFolder.vue'; +import FormInfo from '@/components/MkInfo.vue'; +import MkKeyValue from '@/components/MkKeyValue.vue'; +import MkButton from '@/components/MkButton.vue'; import * as os from '@/os'; import { defaultStore } from '@/store'; -import { $i } from '@/account'; +import { signout, $i } from '@/account'; import { i18n } from '@/i18n'; import { definePageMetadata } from '@/scripts/page-metadata'; import { unisonReload } from '@/scripts/unison-reload'; @@ -52,6 +84,32 @@ function onChangeInjectFeaturedNote(v) { }); } +async function deleteAccount() { + { + const { canceled } = await os.confirm({ + type: 'warning', + text: i18n.ts.deleteAccountConfirm, + }); + if (canceled) return; + } + + const { canceled, result: password } = await os.inputText({ + title: i18n.ts.password, + type: 'password', + }); + if (canceled) return; + + await os.apiWithDialog('i/delete-account', { + password: password, + }); + + await os.alert({ + title: i18n.ts._accountDelete.started, + }); + + await signout(); +} + async function reloadAsk() { const { canceled } = await os.confirm({ type: 'info', diff --git a/packages/frontend/src/router.ts b/packages/frontend/src/router.ts index fa19682f32..e46c1eeb77 100644 --- a/packages/frontend/src/router.ts +++ b/packages/frontend/src/router.ts @@ -164,7 +164,7 @@ export const routes = [{ }, { path: '/migration', name: 'migration', - component: page(() => import('./pages/settings/migration.vue')) + component: page(() => import('./pages/settings/migration.vue')), }, { path: '/custom-css', name: 'general', @@ -174,13 +174,9 @@ export const routes = [{ name: 'profile', component: page(() => import('./pages/settings/accounts.vue')), }, { - path: '/account-info', + path: '/account-stats', name: 'other', - component: page(() => import('./pages/settings/account-info.vue')), - }, { - path: '/delete-account', - name: 'other', - component: page(() => import('./pages/settings/delete-account.vue')), + component: page(() => import('./pages/settings/account-stats.vue')), }, { path: '/other', name: 'other',