fix(plugin-api-doc): non-main application crashes (#3100)
This commit is contained in:
parent
723cc45d0f
commit
7b66def487
@ -16,6 +16,9 @@ const Documentation = () => {
|
|||||||
const { data: urls } = useRequest<{ data: { name: string; url: string }[] }>({ url: 'swagger:getUrls' });
|
const { data: urls } = useRequest<{ data: { name: string; url: string }[] }>({ url: 'swagger:getUrls' });
|
||||||
const requestInterceptor = (req) => {
|
const requestInterceptor = (req) => {
|
||||||
if (!req.headers['Authorization']) {
|
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';
|
||||||
req.headers['Authorization'] = `Bearer ${apiClient.auth.getToken()}`;
|
req.headers['Authorization'] = `Bearer ${apiClient.auth.getToken()}`;
|
||||||
}
|
}
|
||||||
return req;
|
return req;
|
||||||
|
Loading…
Reference in New Issue
Block a user