Skip to content

Commit a7f40a2

Browse files
committed
fix: add lang to header each request in client
1 parent 0131c0f commit a7f40a2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

client/src/lib/http-client.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ELang } from '@/types/share';
12
import axios from 'axios';
23

34
const http_client = axios.create({
@@ -10,6 +11,11 @@ const http_client = axios.create({
1011

1112
http_client.interceptors.request.use(
1213
function (config) {
14+
const lang = localStorage.getItem('lang') || ELang.EN;
15+
16+
config.headers['Accept-Language'] = lang;
17+
config.headers['lang'] = lang;
18+
1319
return config;
1420
},
1521
function (error) {

0 commit comments

Comments
 (0)