import { defineStore } from "pinia";

export const useStore = defineStore("maindev", {
  state: () => ({
    viewport: undefined,
    login: undefined,
    token: undefined,
    common: undefined,
    settings: [],
    showmodal: undefined,
    snackbar: undefined,
    country: undefined,
    lang: "vi",
    branch: {},
    rights: [],
    product: [],
    selectedImeis: [],
  }),
  actions: {
    commit(name, data) {
      // console.trace("commit", name, data);
      this[name] = data;
    },
  },

  persist: {
    pick: ["token", "login", "lang", "selectedImeis"],
    storage: piniaPluginPersistedstate.localStorage(),
  },
});
