import { defineStore } from 'pinia'
import { lang } from '@/settings/designSetting'
import { setLocalStorage, getLocalStorage } from '@/utils'




const LANG_STORE =  "LANG"
const storageLang = getLocalStorage(LANG_STORE)

// 语言
export const useLangStore = defineStore("useLangStore",{
  state: ()  => (
    storageLang || {
      lang
    }
  ), 
  getters: {
    getLang() {
      return this.lang
    }
  },
  actions: {
    changeLang(lang) { 
      this.$state.lang = lang
      setLocalStorage(LANG_STORE, this.$state)
    }
  }
})
