-
-
Notifications
You must be signed in to change notification settings - Fork 132
Open
Description
API Platform version(s) affected: x.y.z
Backend
v3.3.12
Frontend
"@api-platform/admin": "^4.0.1",
Description
When I click on a resource for the first time a lot of requests will fire. Here I reload the page on a specific resource (http://localhost:3000/#/locations). We also tested in prod mode.
Dev Mode
Prod Mode
How to reproduce
Its a simple example. I just use a custom httpClient to set a header for the authorization (jwt).
import { HydraAdmin, hydraDataProvider } from "@api-platform/admin";
import { parseHydraDocumentation } from "@api-platform/api-doc-parser";
import { ENTRYPOINT } from "./constants/entrypoint";
import MyHeaders from "./constants/headers";
import httpClient from "./components/HttpClient";
// Replace with your own API entrypoint
// For instance if https://example.com/api/books is the path to the collection of book resources, then the entrypoint is https://example.com/api
const apiDocumentationParser = () => async () => {
try {
return await parseHydraDocumentation(ENTRYPOINT, {
headers: MyHeaders
});
} catch (result) {
// @ts-ignore
const { api, response, status } = result;
if (status !== 401 || !response) {
throw result;
}
return {
api,
response,
status,
};
}
};
const dataProvider = hydraDataProvider({
entrypoint: ENTRYPOINT,
httpClient: httpClient,
apiDocumentationParser: apiDocumentationParser(),
useEmbedded: false,
});
export default () => (
<HydraAdmin dataProvider={dataProvider} />
);
Additional Context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

