import { defineStore, createPinia, setActivePinia } from 'pinia'; import type { NotificationFragmentFragment } from '~/composables/gql/graphql'; setActivePinia(createPinia()); export const useNotificationsStore = defineStore('notifications', () => { const notifications = ref([]); const isOpen = ref(false); const title = computed(() => isOpen.value ? 'Notifications Are Open' : 'Notifications Are Closed'); const toggle = () => isOpen.value = !isOpen.value; const setNotifications = (newNotifications: NotificationFragmentFragment[]) => { notifications.value = newNotifications; }; return { // state isOpen, // getters title, notifications, // actions setNotifications, toggle, }; });