feat(common): customize labels of confimation modal
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user