-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
38 changed files
with
836 additions
and
295 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from 'react' | ||
import { RESET_2FA_ROUTE, RESET_2FA_SIGNED_TOKEN_PARAM } from './Constants' | ||
import { StyledEngineProvider } from '@mui/material/styles' | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query' | ||
import { | ||
ApplicationSessionManager, | ||
SynapseToastContainer, | ||
} from 'synapse-react-client' | ||
import { SourceAppProvider } from './components/useSourceApp' | ||
import AppInitializer from './AppInitializer' | ||
import { useHistory } from 'react-router-dom' | ||
|
||
const queryClient = new QueryClient({ | ||
defaultOptions: { | ||
queries: { | ||
staleTime: 50 * 1000, // 50s | ||
retry: false, // SynapseClient knows which queries to retry | ||
}, | ||
}, | ||
}) | ||
|
||
/** | ||
* Wraps the application in all required providers, and is also useful for wrapping components under test. | ||
* @constructor | ||
*/ | ||
export default function AppWrapper( | ||
props: React.PropsWithChildren<Record<never, never>>, | ||
) { | ||
const history = useHistory() | ||
|
||
return ( | ||
<StyledEngineProvider injectFirst> | ||
<QueryClientProvider client={queryClient}> | ||
<ApplicationSessionManager | ||
onTwoFactorAuthResetThroughSSO={(twoFaError, twoFaResetCode) => { | ||
// The user completed SSO with a twoFaResetCode | ||
// Send them to the reset 2FA page with the token | ||
history.push( | ||
`${RESET_2FA_ROUTE}?${RESET_2FA_SIGNED_TOKEN_PARAM}=${twoFaResetCode}`, | ||
) | ||
}} | ||
> | ||
<SourceAppProvider> | ||
<SynapseToastContainer /> | ||
<AppInitializer>{props.children}</AppInitializer> | ||
</SourceAppProvider> | ||
</ApplicationSessionManager> | ||
</QueryClientProvider> | ||
</StyledEngineProvider> | ||
) | ||
} |
Oops, something went wrong.