import {Store} from "vuex";
import {TYPE_ALERT} from "~/types/enums";
import {Alert} from "~/types/interfaces";

export default class Page {
  private store

  constructor(store:Store<any>) {
    this.store = store
  }

  /**
   * 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.store.commit('page/setAlert', alert)
  }
}
