import { defineStore } from 'pinia'
import i18n from "../../lang/index.js";

const useLocaleStore = defineStore('locale', {
  state: () => {
    return {
      locale: localStorage.getItem('lang') || 'zhCn',
    }
  },
  actions: {
    SET_LOCALE(locale) {
      this.locale = locale
      localStorage.setItem('lang', locale)
      i18n.global.locale.value = locale
    },
  },
  getters: {},
})

export default useLocaleStore