enhance(client): show confirm dialog when logout

This commit is contained in:
syuilo 2022-06-30 15:09:10 +09:00
parent 36ec7462d7
commit d9c7409a6c
2 changed files with 8 additions and 1 deletions

View File

@ -860,6 +860,7 @@ deleteAccount: "アカウント削除"
document: "ドキュメント" document: "ドキュメント"
numberOfPageCache: "ページキャッシュ数" numberOfPageCache: "ページキャッシュ数"
numberOfPageCacheDescription: "多くすると利便性が向上しますが、負荷とメモリ使用量が増えます。" numberOfPageCacheDescription: "多くすると利便性が向上しますが、負荷とメモリ使用量が増えます。"
logoutConfirm: "ログアウトしますか?"
_emailUnavailable: _emailUnavailable:
used: "既に使用されています" used: "既に使用されています"

View File

@ -32,6 +32,7 @@ import { unisonReload } from '@/scripts/unison-reload';
import { instance } from '@/instance'; import { instance } from '@/instance';
import { useRouter } from '@/router'; import { useRouter } from '@/router';
import { definePageMetadata, provideMetadataReceiver, setPageMetadata } from '@/scripts/page-metadata'; import { definePageMetadata, provideMetadataReceiver, setPageMetadata } from '@/scripts/page-metadata';
import * as os from '@/os';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
initialPage?: string; initialPage?: string;
@ -181,7 +182,12 @@ const menuDef = computed(() => [{
type: 'button', type: 'button',
icon: 'fas fa-sign-in-alt fa-flip-horizontal', icon: 'fas fa-sign-in-alt fa-flip-horizontal',
text: i18n.ts.logout, text: i18n.ts.logout,
action: () => { action: async () => {
const { canceled } = await os.confirm({
type: 'warning',
text: i18n.ts.logoutConfirm,
});
if (canceled) return;
signout(); signout();
}, },
danger: true, danger: true,