| 12345678910111213141516171819202122232425262728293031 |
- import {Alert, pageState} from '~/types/interfaces'
- import {defineStore} from "pinia";
- import {useFormStore} from "~/store/form";
- 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)
- }
- }
- })
|