feat(common): customize labels of confimation modal

This commit is contained in:
2026-02-03 21:44:35 +01:00
parent df3a78560b
commit 58eccd450c
2 changed files with 14 additions and 3 deletions

View File

@@ -9,6 +9,8 @@ export const useConfirmationModal = defineStore("confirmationModal", {
state: () => ({
isOpen: false,
text: "",
aLabel: null as string | null,
bLabel: null as string | null,
onConfirm: null as (() => void) | null,
onCancel: null as (() => void) | null,
onClosed: null as ((choice: "confirm" | "cancel") => void) | null,
@@ -22,6 +24,8 @@ export const useConfirmationModal = defineStore("confirmationModal", {
actions: {
open(options: {
text: string;
aLabel?: string;
bLabel?: string;
onCancel?: () => void;
onConfirm?: () => void;
onClosed?: (choice: "confirm" | "cancel") => void;
@@ -29,6 +33,8 @@ export const useConfirmationModal = defineStore("confirmationModal", {
}) {
gsap.killTweensOf(this);
this.text = options.text;
this.aLabel = options.aLabel ?? null;
this.bLabel = options.bLabel ?? null;
this.onConfirm = options.onConfirm ?? null;
this.onCancel = options.onCancel ?? null;
this.onClosed = options.onClosed ?? null;