mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-10 18:47:26 +08:00
[O] Make confirm callback nullable
This commit is contained in:
@@ -13,9 +13,9 @@
|
|||||||
export let error: string | null
|
export let error: string | null
|
||||||
export let loading: boolean = false
|
export let loading: boolean = false
|
||||||
|
|
||||||
function doConfirm(fn: () => void) {
|
function doConfirm(fn?: () => void) {
|
||||||
confirm = null
|
confirm = null
|
||||||
fn()
|
fn && fn()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -27,9 +27,9 @@
|
|||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
{#if confirm.cancel}
|
{#if confirm.cancel}
|
||||||
<button on:click={() => doConfirm(confirm!!.cancel!!)}>{t('action.cancel')}</button>
|
<button on:click={() => doConfirm(confirm?.cancel)}>{t('action.cancel')}</button>
|
||||||
{/if}
|
{/if}
|
||||||
<button on:click={() => doConfirm(confirm!!.confirm)} class:error={confirm.dangerous}>{t('action.confirm')}</button>
|
<button on:click={() => doConfirm(confirm?.confirm)} class:error={confirm.dangerous}>{t('action.confirm')}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export interface CardSummary {
|
|||||||
export interface ConfirmProps {
|
export interface ConfirmProps {
|
||||||
title: string
|
title: string
|
||||||
message: string
|
message: string
|
||||||
confirm: () => void
|
confirm?: () => void
|
||||||
cancel?: () => void
|
cancel?: () => void
|
||||||
dangerous?: boolean
|
dangerous?: boolean
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user