kaboot/index.tsx

29 lines
No EOL
747 B
TypeScript

import React from 'react';
import ReactDOM from 'react-dom/client';
import { AuthProvider } from 'react-oidc-context';
import App from './App';
import { oidcConfig } from './src/config/oidc';
const rootElement = document.getElementById('root');
if (!rootElement) {
throw new Error("Could not find root element to mount to");
}
const onSigninCallback = () => {
window.history.replaceState({}, document.title, window.location.pathname);
};
const root = ReactDOM.createRoot(rootElement);
root.render(
<React.StrictMode>
<AuthProvider
{...oidcConfig}
onSigninCallback={onSigninCallback}
onRemoveUser={() => {
window.localStorage.clear();
}}
>
<App />
</AuthProvider>
</React.StrictMode>
);