mirror of
https://github.com/unraid/api.git
synced 2026-01-04 07:29:48 -06:00
29 lines
793 B
TypeScript
29 lines
793 B
TypeScript
import { defineStore, createPinia, setActivePinia } from 'pinia';
|
|
import type { NotificationFragmentFragment } from '~/composables/gql/graphql';
|
|
|
|
setActivePinia(createPinia());
|
|
|
|
export const useNotificationsStore = defineStore('notifications', () => {
|
|
const notifications = ref<NotificationFragmentFragment[]>([]);
|
|
const isOpen = ref<boolean>(false);
|
|
|
|
const title = computed<string>(() => 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,
|
|
};
|
|
});
|