enhance(client): show confirm dialog when logout

This commit is contained in:
syuilo 2022-06-30 15:09:10 +09:00
parent 47dcb1b41f
commit 6f2d2a71f9
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,