import { ref } from 'vue' import { defineStore } from 'pinia' export const useToastStore = defineStore('toast', () => { const toasts = ref([]) function show(message, type = 'success', duration = 4000) { const id = Date.now() + Math.random() toasts.value.push({ id, message, type, duration }) if (duration > 0) setTimeout(() => dismiss(id), duration) } function dismiss(id) { toasts.value = toasts.value.filter(t => t.id !== id) } return { toasts, show, dismiss } })