UNPKG

@axa-fr/react-oidc-context-fetch

Version:

Inject authentification behavior to fetch using react High Order Component

16 lines (11 loc) 439 B
import { compose } from '@axa-fr/react-oidc-core'; import { withFetchRedirectionOn403, withFetchSilentAuthenticateAndRetryOn401 } from '@axa-fr/react-oidc-fetch-core'; import withFetchToken from './withFetchToken'; type WindowFetch = typeof fetch; const enhance = (fetch: WindowFetch) => compose( withFetchToken(fetch), withFetchSilentAuthenticateAndRetryOn401(), withFetchRedirectionOn403() ); export default enhance;