import { Alert, pageState } from '~/types/interfaces'

export const state = () => ({
  alerts: []
})

export const mutations = {
  setAlert (state: pageState, alert: Alert) {
    state.alerts.push(alert)
  },
  removeAlert (state: pageState) {
    state.alerts.shift()
  }
}

export const actions = {
  removeSlowlyAlert (context: any) {
    setTimeout(() => {
      context.commit('removeAlert')
    }, 300)
  }
}
