Browse Source

fix: replace hardcoded demo token in request interceptor (#11833)

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
pull/11855/head
afc163 3 months ago
committed by GitHub
parent
commit
187d653b9e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      src/requestErrorConfig.ts

8
src/requestErrorConfig.ts

@ -94,8 +94,12 @@ export const errorConfig: RequestConfig = {
requestInterceptors: [
(config: RequestOptions) => {
// 拦截请求配置,进行个性化处理。
const url = config?.url?.concat('?token=123');
return { ...config, url };
// 示例:为请求附加 token(按需启用)
// const token = localStorage.getItem('token');
// if (token) {
// config.headers = { ...config.headers, Authorization: `Bearer ${token}` };
// }
return config;
},
],

Loading…
Cancel
Save