ff-admin/src/stores/modal.ts
2025-03-24 16:18:23 +01:00

26 lines
642 B
TypeScript

import { defineStore } from "pinia";
export const useModalStore = defineStore("modal", {
state: () => {
return {
show: false,
component_ref: undefined as any,
data: undefined as any,
callback: undefined as undefined | Function,
};
},
actions: {
openModal(component_ref: any, data?: any, callback?: Function) {
this.component_ref = component_ref;
this.data = data;
this.callback = callback;
this.show = true;
},
closeModal() {
this.component_ref = undefined;
this.data = undefined;
this.callback = undefined;
this.show = false;
},
},
});