Browse Source

添加请求头Lang

main
mac 4 months ago
parent
commit
abeb63ee03
  1. 2
      src/http/service.ts

2
src/http/service.ts

@ -5,6 +5,7 @@ import signGenerator from './sign';
import qs from 'qs'; import qs from 'qs';
import store from '../store'; import store from '../store';
import { notification } from 'antd'; import { notification } from 'antd';
import { TRADER_LANGUAGE } from '../language';
const service = axios.create(axiosConfig); const service = axios.create(axiosConfig);
@ -23,6 +24,7 @@ service.interceptors.request.use(
(config.headers as any).sign = sign; (config.headers as any).sign = sign;
(config.headers as any).timestamp = timestamp; (config.headers as any).timestamp = timestamp;
(config.headers as any).Token = store.state.token; (config.headers as any).Token = store.state.token;
(config.headers as any).Lang = window.localStorage.getItem(TRADER_LANGUAGE) || "zh";
if (config.data instanceof FormData) return config; if (config.data instanceof FormData) return config;

Loading…
Cancel
Save