-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmain.tsx
27 lines (24 loc) · 1013 Bytes
/
main.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './components/app/App.tsx'
import './index.css'
import {AuthProvider, TAuthConfig, TRefreshTokenExpiredEvent} from "react-oauth2-code-pkce"
import {BrowserRouter} from "react-router-dom";
const authConfig: TAuthConfig = {
clientId: 'client',
authorizationEndpoint: 'http://localhost:8080/oauth2/authorize',
tokenEndpoint: 'http://localhost:8080/oauth2/token',
redirectUri: 'http://localhost:5173/',
logoutEndpoint: 'http://localhost:8080/logout',
decodeToken: false,
onRefreshTokenExpire: (event: TRefreshTokenExpiredEvent) => window.confirm('Session expired. Refresh page to continue using the site?') && event.login(),
}
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<AuthProvider authConfig={authConfig}>
<React.StrictMode>
<BrowserRouter>
<App/>
</BrowserRouter>
</React.StrictMode>
</AuthProvider>,
)