View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1081 Closes #1075 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Marie <github@yuugi.dev>
This commit is contained in:
commit
7bb4f9c9cc
7 changed files with 115 additions and 56 deletions
|
|
@ -12,6 +12,10 @@ let isReloadConfirming = false;
|
|||
export async function reloadAsk(opts: {
|
||||
unison?: boolean;
|
||||
reason?: string;
|
||||
type?: 'error' | 'info' | 'success' | 'warning' | 'waiting' | 'question';
|
||||
title?: string;
|
||||
okText?: string;
|
||||
cancelText?: string;
|
||||
}) {
|
||||
if (isReloadConfirming) {
|
||||
return;
|
||||
|
|
@ -19,13 +23,12 @@ export async function reloadAsk(opts: {
|
|||
|
||||
isReloadConfirming = true;
|
||||
|
||||
const { canceled } = await os.confirm(opts.reason == null ? {
|
||||
type: 'info',
|
||||
text: i18n.ts.reloadConfirm,
|
||||
} : {
|
||||
type: 'info',
|
||||
title: i18n.ts.reloadConfirm,
|
||||
text: opts.reason,
|
||||
const { canceled } = await os.confirm({
|
||||
type: opts.type ?? 'question',
|
||||
title: opts.title ?? i18n.ts.reloadConfirm,
|
||||
text: opts.reason ?? undefined,
|
||||
okText: opts.okText ?? i18n.ts.yes,
|
||||
cancelText: opts.cancelText ?? i18n.ts.no,
|
||||
}).finally(() => {
|
||||
isReloadConfirming = false;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue