feat(i18n): add Accept-Language header to all API requests

This commit is contained in:
ghostubborn 2026-04-01 15:22:07 +08:00
parent c8a1bd5cbf
commit 2ffadd3038
1 changed files with 2 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import axios from 'axios' import axios from 'axios'
import i18n from '../i18n'
// 创建axios实例 // 创建axios实例
const service = axios.create({ const service = axios.create({
@ -12,6 +13,7 @@ const service = axios.create({
// 请求拦截器 // 请求拦截器
service.interceptors.request.use( service.interceptors.request.use(
config => { config => {
config.headers['Accept-Language'] = i18n.global.locale.value
return config return config
}, },
error => { error => {