ff-admin/src/stores/modal.ts

27 lines
642 B
TypeScript
Raw Normal View History

2024-08-25 13:37:23 +02:00
import { defineStore } from "pinia";
export const useModalStore = defineStore("modal", {
state: () => {
return {
show: false,
2025-03-24 16:18:23 +01:00
component_ref: undefined as any,
data: undefined as any,
callback: undefined as undefined | Function,
2024-08-25 13:37:23 +02:00
};
},
actions: {
2025-03-24 16:18:23 +01:00
openModal(component_ref: any, data?: any, callback?: Function) {
2024-08-25 13:37:23 +02:00
this.component_ref = component_ref;
this.data = data;
2025-03-24 16:18:23 +01:00
this.callback = callback;
2024-08-25 13:37:23 +02:00
this.show = true;
},
closeModal() {
2025-03-24 16:18:23 +01:00
this.component_ref = undefined;
this.data = undefined;
this.callback = undefined;
2024-08-25 13:37:23 +02:00
this.show = false;
},
},
});