import { defineStore } from 'pinia' import { ref } from 'vue' export interface Notification { id: number message: string type: 'info' | 'success' | 'error' | 'warning' timestamp: Date visible: boolean } export interface AppUser { id: number username: string full_name: string | null is_superuser: boolean [key: string]: any } export const useAppStore = defineStore('app', () => { const user = ref(null) const token = ref(null) const loading = ref(false) const notifications = ref([]) const initialized = ref(false) function dismissNotification(id: number) { const index = notifications.value.findIndex(n => n.id === id) if (index > -1) notifications.value.splice(index, 1) } return { user, token, loading, notifications, initialized, dismissNotification, } })