18 lines
305 B
JavaScript
18 lines
305 B
JavaScript
|
import Cookies from 'js-cookie';
|
||
|
|
||
|
const I18N_LANG = 'user_lang';
|
||
|
export default {
|
||
|
setLang(lang) {
|
||
|
Cookies.setItem(I18N_LANG, lang);
|
||
|
},
|
||
|
getLang(defaultLang) {
|
||
|
const localLang = Cookies.getItem(I18N_LANG);
|
||
|
|
||
|
if (localLang === null) {
|
||
|
return defaultLang;
|
||
|
} else {
|
||
|
return localLang;
|
||
|
}
|
||
|
}
|
||
|
};
|