import Cookies from "js-cookie";
import { getLanguage } from "~/lang/index";

const I18N = {
  namespaced: true,
  state: {
    lang: getLanguage(),
  },
  mutations: {
    SET_LANG(state, lang) {
      state.lang = lang;
      Cookies.set("language", lang);
    },
  },
  actions: {
    setLang({ commit }, lang) {
      commit("SET_LANG", lang);
    },
  },
};
export default I18N;
