import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import { LANG } from '@/constant';

export const useLanguageStore = defineStore('language', () => {
    const language = ref(localStorage.getItem(LANG) || "zh-CN")

    function setLanguage(lang) {
        localStorage.setItem(LANG, lang);
        language.value = lang;
    }

    return {
        language,
        setLanguage
    }
})