forked from github/dataease
Merge pull request #1875 from dataease/pr@v1.8@fix_mobile_login_i18n
fix: 移动端登录失败提示国际化
This commit is contained in:
commit
179b9b02e6
@ -1,6 +1,6 @@
|
||||
import axios from 'axios'
|
||||
import Config from '@/settings'
|
||||
import { getToken, setToken, setUserInfo } from '@/common/utils'
|
||||
import { getToken, setToken, setUserInfo, parseLanguage } from '@/common/utils'
|
||||
const TokenKey = Config.TokenKey
|
||||
const RefreshTokenKey = Config.RefreshTokenKey
|
||||
const white_list = Config.WHITE_LIST
|
||||
@ -15,6 +15,17 @@ let service = axios.create({
|
||||
// request interceptor
|
||||
service.interceptors.request.use(
|
||||
config => {
|
||||
|
||||
let lang = parseLanguage() || uni.getLocale()
|
||||
if (lang === 'en') {
|
||||
config.headers['Accept-Language'] = 'en-US'
|
||||
}else if(lang === 'zh-Hant'){
|
||||
config.headers['Accept-Language'] = 'zh-TW'
|
||||
}else {
|
||||
config.headers['Accept-Language'] = 'zh-CN'
|
||||
}
|
||||
|
||||
|
||||
if (white_list.includes(config.url)) {
|
||||
return config
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user