# hostinger/trunk/vue-frontend/src/stores/modalStore.ts

Hostinger Tools, version trunk. 28 lines.

- Page: https://pluginprobe.com/plugins/hostinger/trunk/code/vue-frontend/src/stores/modalStore.ts
- Raw: https://pluginprobe.com/plugins/hostinger/trunk/raw/vue-frontend/src/stores/modalStore.ts
- Modified: 2025-09-09T07:18:12+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/hostinger/trunk/code/vue-frontend/src/stores/modalStore.ts#L10-L20`.

```typescript
import { defineStore } from "pinia";
import { ref } from "vue";

import { ModalContent, ModalSettings } from "@/types";
import { ModalName } from "@/types/enums";

export const useModalStore = defineStore("modalStore", () => {
	interface Modal {
		name: ModalName;
		data?: ModalContent;
		settings?: ModalSettings;
	}

	const activeModal = ref<Modal | null>(null);

	const openModal = (
		name: ModalName,
		data?: ModalContent,
		settings?: ModalSettings
	) => {
		activeModal.value = { name, data, settings };
	};

	const closeModal = () => (activeModal.value = null);

	return { activeModal, openModal, closeModal };
});

```
