import { defineStore } from 'pinia' import { ref } from 'vue' export type NotificationType = 'success' | 'error' | 'warning' | 'info' export const useNotificationStore = defineStore('notification', () => { const visible = ref(false) const message = ref('') const type = ref('info') const timeout = ref(5000) function show(msg: string, color: NotificationType = 'error', duration = 5000) { message.value = msg type.value = color timeout.value = duration visible.value = true } function hide() { visible.value = false } return { visible, message, type, timeout, show, hide } })