Przeglądaj źródła

请求添加lang header

Zimo 4 godzin temu
rodzic
commit
0cab7206a9
1 zmienionych plików z 4 dodań i 0 usunięć
  1. 4 0
      src/config/axios/index.ts

+ 4 - 0
src/config/axios/index.ts

@@ -6,10 +6,14 @@ const { default_headers } = config
 
 const request = (option: any) => {
   const { headersType, headers, ...otherOption } = option
+
+  const langStore = JSON.parse(localStorage.getItem('lang') || '{}')
+
   return service({
     ...otherOption,
     headers: {
       'Content-Type': headersType || default_headers,
+      Lang: langStore.v,
       ...headers
     }
   })