Skip to content

Commit

Permalink
Added overrideShowRefreshExpiryDialog prop to ProviderProps
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyMitch committed Mar 21, 2024
1 parent 7f27c17 commit c510bea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import { AuthContext } from '../context';
* @property {string} backendURL - (optional) Specify backend api url, default = '/api'.
* @property {IdentityProvider} idpHint - (optional) Identity provider to improve login.
* @property {Function} onRefreshExpiry - (optional) Function to call when refresh token expires.
* @property {boolean} overrideShowRefreshExpiryDialog - (optional) Show RefreshExpiryDialog.
*/
export const SSOProvider = (props: SSOProviderProps) => {
const { children, backendURL, idpHint, onRefreshExpiry } = props;
const { children, backendURL, idpHint, onRefreshExpiry, overrideShowRefreshExpiryDialog } = props;
const [isExpiryDialogVisible, setIsExpiryDialogVisible] = useState(false);

// Initialize the authentication state and dispatch function using the reducer.
Expand All @@ -30,7 +31,10 @@ export const SSOProvider = (props: SSOProviderProps) => {
>
{children}
</SSOWrapper>
<RefreshExpiryDialog loginProps={{ backendURL, idpHint }} isVisible={isExpiryDialogVisible} />
<RefreshExpiryDialog
loginProps={{ backendURL, idpHint }}
isVisible={overrideShowRefreshExpiryDialog ? true : isExpiryDialogVisible}
/>
</AuthContext.Provider>
);
};
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type SSOProviderProps = {
idpHint?: IdentityProvider;
children: ReactNode;
onRefreshExpiry?: Function;
overrideShowRefreshExpiryDialog?: boolean;
};
export type SSOWrapperProps = {
backendURL?: string;
Expand Down

0 comments on commit c510bea

Please sign in to comment.