fix(api-doc): invalid headers
This commit is contained in:
parent
1871fdd895
commit
57a2bac72a
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user