import { defineStore } from 'pinia'; export const useAlertStore = defineStore('alert', { state: () => ({ message: '', type: 'info' as 'success' | 'error' | 'info' | 'warning', visible: false, }), actions: { showAlert(msg: string, type: 'success' | 'error' | 'info' | 'warning' = 'info') { this.message = msg; this.type = type; this.visible = true; // Auto-hide after 3 seconds (optional) setTimeout(() => this.hideAlert(), 3000); }, hideAlert() { this.visible = false; this.message = ''; }, }, });