feat(common): add onCancel callback in the confirmation modal
This commit is contained in:
@@ -22,6 +22,7 @@ const handleActivateA = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleActivateB = () => {
|
const handleActivateB = () => {
|
||||||
|
confirmationModal.onCancel?.();
|
||||||
confirmationModal.close();
|
confirmationModal.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export const useConfirmationModal = defineStore("confirmationModal", {
|
|||||||
text: "",
|
text: "",
|
||||||
onConfirm: null as (() => void) | null,
|
onConfirm: null as (() => void) | null,
|
||||||
onClosed: null as (() => void) | null,
|
onClosed: null as (() => void) | null,
|
||||||
|
onCancel: null as (() => void) | null,
|
||||||
offsetY: MODAL_MAX_Y_OFFSET,
|
offsetY: MODAL_MAX_Y_OFFSET,
|
||||||
buttonsYOffset: 0,
|
buttonsYOffset: 0,
|
||||||
modalButtonsYOffset: BUTTONS_MAX_Y_OFFSET,
|
modalButtonsYOffset: BUTTONS_MAX_Y_OFFSET,
|
||||||
@@ -21,12 +22,14 @@ export const useConfirmationModal = defineStore("confirmationModal", {
|
|||||||
actions: {
|
actions: {
|
||||||
open(options: {
|
open(options: {
|
||||||
text: string;
|
text: string;
|
||||||
|
onCancel?: () => void;
|
||||||
onConfirm?: () => void;
|
onConfirm?: () => void;
|
||||||
onClosed?: () => void;
|
onClosed?: () => void;
|
||||||
}) {
|
}) {
|
||||||
gsap.killTweensOf(this);
|
gsap.killTweensOf(this);
|
||||||
this.text = options.text;
|
this.text = options.text;
|
||||||
this.onConfirm = options.onConfirm ?? null;
|
this.onConfirm = options.onConfirm ?? null;
|
||||||
|
this.onCancel = options.onCancel ?? null;
|
||||||
this.onClosed = options.onClosed ?? null;
|
this.onClosed = options.onClosed ?? null;
|
||||||
this.isVisible = true;
|
this.isVisible = true;
|
||||||
this.isClosing = false;
|
this.isClosing = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user