-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(silentcallback): Catch any errors in async playCallbackAsync
- Loading branch information
1 parent
8797330
commit f6cf194
Showing
1 changed file
with
14 additions
and
7 deletions.
There are no files selected for viewing
21 changes: 14 additions & 7 deletions
21
packages/react-oidc/src/core/default-component/SilentCallback.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
import { OidcClient } from '@axa-fr/oidc-client'; | ||
import { ComponentType, useEffect } from 'react'; | ||
import { FC, useEffect } from 'react'; | ||
|
||
const SilentCallbackManager: ComponentType<any> = ({ configurationName }) => { | ||
export interface SilentCallbackProps { | ||
configurationName: string; | ||
} | ||
|
||
const SilentCallbackManager: FC<SilentCallbackProps> = ({ configurationName }) => { | ||
useEffect(() => { | ||
const playCallbackAsync = async () => { | ||
const getOidc = OidcClient.get; | ||
const oidc = getOidc(configurationName); | ||
const oidc = OidcClient.get(configurationName); | ||
oidc.silentLoginCallbackAsync(); | ||
}; | ||
playCallbackAsync(); | ||
}, []); | ||
|
||
return <></>; | ||
playCallbackAsync().catch(error => { | ||
console.error('Error during silent login callback:', error); | ||
}); | ||
|
||
}, [configurationName]); | ||
|
||
return null; | ||
}; | ||
|
||
export default SilentCallbackManager; |