Merge branch 'main' of github.com:dataease/dataease into main

This commit is contained in:
taojinlong 2021-05-19 10:18:12 +08:00
commit 14a5d7f667
2 changed files with 6 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import { format } from '@/utils/formatUi'
import { getLanguage } from '@/lang/index'
import Cookies from 'js-cookie'
import router from '@/router'
import i18n from '@/lang'
const getDefaultState = () => {
return {
token: getToken(),
@ -57,6 +58,9 @@ const mutations = {
SET_LANGUAGE: (state, language) => {
state.language = language
Cookies.set('language', language)
if (language && i18n.locale !== language) {
i18n.locale = language
}
}
}

View File

@ -36,7 +36,8 @@ service.interceptors.request.use(
}
if (i18n.locale) {
config.headers['Accept-Language'] = i18n.locale
const lang = i18n.locale.replace('_', '-')
config.headers['Accept-Language'] = lang
}
// 增加loading