page.ts 402 B

12345678910111213141516171819202122
  1. import {alert, pageState} from "~/types/interfaces";
  2. export const state = () => ({
  3. alerts: []
  4. })
  5. export const mutations = {
  6. setAlert(state:pageState, alert:alert){
  7. state.alerts.push(alert)
  8. },
  9. removeAlert(state:pageState){
  10. state.alerts.shift()
  11. }
  12. }
  13. export const actions = {
  14. removeSlowlyAlert(context:any){
  15. setTimeout(()=>{
  16. context.commit('removeAlert')
  17. }, 300)
  18. }
  19. }