diff --git a/frontend/composables/use-confirm.ts b/frontend/composables/use-confirm.ts index 2055d06..9c408ff 100644 --- a/frontend/composables/use-confirm.ts +++ b/frontend/composables/use-confirm.ts @@ -1,10 +1,11 @@ -import { UseConfirmDialogReturn } from "@vueuse/core"; +import { UseConfirmDialogRevealResult, UseConfirmDialogReturn } from "@vueuse/core"; import { Ref } from "vue"; // eslint-disable-next-line @typescript-eslint/no-explicit-any type Store = UseConfirmDialogReturn & { text: Ref; setup: boolean; + open: (text: string) => Promise>; }; const store: Partial = { @@ -30,13 +31,13 @@ export function useConfirm(): Store { store.cancel = cancel; } - async function openDialog(msg: string) { + async function openDialog(msg: string): Promise> { store.text.value = msg; return await store.reveal(); } return { ...(store as Store), - reveal: openDialog, + open: openDialog, }; } diff --git a/frontend/pages/item/[id]/edit.vue b/frontend/pages/item/[id]/edit.vue index 59ab0a4..e064803 100644 --- a/frontend/pages/item/[id]/edit.vue +++ b/frontend/pages/item/[id]/edit.vue @@ -204,7 +204,7 @@ const confirm = useConfirm(); async function deleteAttachment(attachmentId: string) { - const confirmed = await confirm.reveal("Are you sure you want to delete this attachment?"); + const confirmed = await confirm.open("Are you sure you want to delete this attachment?"); if (confirmed.isCanceled) { return; diff --git a/frontend/pages/item/[id]/index.vue b/frontend/pages/item/[id]/index.vue index 8f4d489..1216ec1 100644 --- a/frontend/pages/item/[id]/index.vue +++ b/frontend/pages/item/[id]/index.vue @@ -174,7 +174,7 @@ const confirm = useConfirm(); async function deleteItem() { - const confirmed = await confirm.reveal("Are you sure you want to delete this item?"); + const confirmed = await confirm.open("Are you sure you want to delete this item?"); if (!confirmed.data) { return; diff --git a/frontend/pages/label/[id].vue b/frontend/pages/label/[id].vue index d27fb42..5347202 100644 --- a/frontend/pages/label/[id].vue +++ b/frontend/pages/label/[id].vue @@ -58,10 +58,12 @@ return details; }); - const { reveal } = useConfirm(); + const confirm = useConfirm(); async function confirmDelete() { - const { isCanceled } = await reveal("Are you sure you want to delete this label? This action cannot be undone."); + const { isCanceled } = await confirm.open( + "Are you sure you want to delete this label? This action cannot be undone." + ); if (isCanceled) { return; @@ -154,7 +156,7 @@
Items -
+