From 331c3002ba73c7b1768c382826363f31d94283d1 Mon Sep 17 00:00:00 2001 From: chenos Date: Thu, 5 Dec 2024 15:17:46 +0800 Subject: [PATCH] fix: loss of request headers on silent requests (#5795) --- packages/core/client/src/api-client/APIClient.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/core/client/src/api-client/APIClient.ts b/packages/core/client/src/api-client/APIClient.ts index 78ba5bbc6f..3b358e0073 100644 --- a/packages/core/client/src/api-client/APIClient.ts +++ b/packages/core/client/src/api-client/APIClient.ts @@ -7,7 +7,7 @@ * For more information, please refer to: https://www.nocobase.com/agreement. */ -import { APIClient as APIClientSDK, getSubAppName } from '@nocobase/sdk'; +import { APIClient as APIClientSDK } from '@nocobase/sdk'; import { Result } from 'ahooks/es/useRequest/src/types'; import { notification } from 'antd'; import React from 'react'; @@ -91,10 +91,10 @@ export class APIClient extends APIClientSDK { interceptors() { this.axios.interceptors.request.use((config) => { config.headers['X-With-ACL-Meta'] = true; - const appName = this.app ? getSubAppName(this.app.getPublicPath()) : null; - if (appName) { - config.headers['X-App'] = appName; - } + const headers = this.getHeaders(); + Object.keys(headers).forEach((key) => { + config.headers[key] = headers[key]; + }); return config; }); super.interceptors();