import type {DefineComponent} from "vue";

export const usePopup = defineStore('namespace', {
    state: () => ({
        component: undefined as DefineComponent | undefined,
        data: undefined as any,
        isOpen: false as boolean
    }),
    getters: {

    },
    actions: {
        open(component: DefineComponent, data?: any) {
            this.component = component;
            this.data = data;
            this.isOpen = true;
        },
        close() {
            this.component = undefined;
            this.data = undefined;
            this.isOpen = false;
        }
    }
})