| 123456789101112131415161718192021222324252627282930 |
- import {Alert, pageState} from '~/types/interfaces'
- import {defineStore} from "pinia";
- import {FORM_FUNCTION, TYPE_ALERT} from "~/types/enums";
- export const usePageStore = defineStore('page', {
- state: (): pageState => {
- return {
- alerts: []
- }
- },
- actions: {
- removeSlowlyAlert () {
- setTimeout(() => {
- this.alerts.shift()
- }, 300)
- },
- /**
- * Ajout des alerts dans le store
- * @param type
- * @param alerts
- */
- addAlerts(type: TYPE_ALERT, alerts: Array<string>){
- const alert:Alert = {
- type: type,
- messages: alerts
- }
- this.alerts.push(alert)
- }
- }
- })
|