Skip to content

Commit

Permalink
Merge pull request #11 from marmelab/fix-httpClient
Browse files Browse the repository at this point in the history
Fix `httpClient` should not throw if user is disconnected
  • Loading branch information
djhi committed Dec 20, 2023
2 parents 5f07374 + 2355d51 commit 6065d6e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/ra-auth-auth0/src/httpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ export const httpClient = (auth0Client: any) => async (
url: any,
options: fetchUtils.Options | undefined
) => {
const token = await auth0Client.getTokenSilently();
let token: string | null = null;
try {
token = await auth0Client.getTokenSilently();
} catch (error) {
// Nothing to do, we just won't set the Authorization header
}
const requestHeaders = getAuth0Headers(token, options);
return fetchUtils.fetchJson(url, {
...options,
Expand Down

0 comments on commit 6065d6e

Please sign in to comment.