@lark-apaas/client-toolkit 1.2.10-alpha.18 → 1.2.10-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -140,7 +140,11 @@ class ApiProxy {
140
140
  headers: {
141
141
  ...this.defaultConfig.headers,
142
142
  ...config.headers,
143
- 'X-Client-Referer': 'undefined' != typeof window && window.location?.href ? window.location.href : ''
143
+ 'X-Page-Route': (()=>{
144
+ if ('undefined' == typeof window || !window.location?.pathname) return '/';
145
+ const pathname = window.location.pathname;
146
+ return pathname.replace(/^\/(af|spark)\/p\/[^/]+/, '') || '/';
147
+ })()
144
148
  }
145
149
  };
146
150
  const requestKey = this.generateRequestKey(mergedConfig);
@@ -234,7 +234,11 @@ function initAxiosConfig(axiosInstance) {
234
234
  config._startTime = config._startTime || Date.now();
235
235
  const csrfToken = window.csrfToken;
236
236
  if (csrfToken) config.headers['X-Suda-Csrf-Token'] = csrfToken;
237
- if ('undefined' != typeof window && window.location?.href) config.headers['X-Client-Referer'] = window.location.href;
237
+ if ('undefined' != typeof window && window.location?.pathname) {
238
+ const pathname = window.location.pathname;
239
+ const pageRoute = pathname.replace(/^\/(af|spark)\/p\/[^/]+/, '') || '/';
240
+ config.headers['X-Page-Route'] = pageRoute;
241
+ }
238
242
  return config;
239
243
  }, (error)=>Promise.reject(error));
240
244
  instance.interceptors.response.use((response)=>response, (error)=>{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/client-toolkit",
3
- "version": "1.2.10-alpha.18",
3
+ "version": "1.2.10-alpha.19",
4
4
  "types": "./lib/index.d.ts",
5
5
  "main": "./lib/index.js",
6
6
  "files": [