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;