From 57a2bac72a586916297314b17f932aff624b6a2f Mon Sep 17 00:00:00 2001 From: chenos Date: Fri, 12 Jan 2024 09:14:27 +0800 Subject: [PATCH] fix(api-doc): invalid headers --- .../@nocobase/plugin-api-doc/src/client/Document.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-api-doc/src/client/Document.tsx b/packages/plugins/@nocobase/plugin-api-doc/src/client/Document.tsx index c7ee6806f..b515fcdfb 100644 --- a/packages/plugins/@nocobase/plugin-api-doc/src/client/Document.tsx +++ b/packages/plugins/@nocobase/plugin-api-doc/src/client/Document.tsx @@ -12,13 +12,13 @@ const Documentation = () => { const apiClient = useAPIClient(); const { t } = useTranslation(); const swaggerUIRef = useRef(); - const { data: urls } = useRequest<{ data: { name: string; url: string }[] }>({ url: 'swagger:getUrls' }); const requestInterceptor = (req) => { if (!req.headers['Authorization']) { const match = location.pathname.match(/^\/apps\/([^/]*)\//); - // multi apps need to set X-App header - req.headers['X-App'] = match?.[1] || 'main'; + if (match?.[1]) { + req.headers['X-App'] = match?.[1]; + } req.headers['Authorization'] = `Bearer ${apiClient.auth.getToken()}`; } return req;