fix: small fixes
This commit is contained in:
parent
f4b890b6b3
commit
3d40ff7912
4 changed files with 14 additions and 21 deletions
34
src/main.tsx
34
src/main.tsx
|
|
@ -1,35 +1,27 @@
|
||||||
import { StrictMode } from 'react'
|
import {StrictMode} from 'react'
|
||||||
import { createRoot } from 'react-dom/client'
|
import {createRoot} from 'react-dom/client'
|
||||||
import './index.css'
|
import './index.css'
|
||||||
import App from './App.tsx'
|
import App from './App.tsx'
|
||||||
import {AuthProvider, type AuthProviderProps} from "react-oidc-context";
|
import {AuthProvider, type AuthProviderProps} from "react-oidc-context";
|
||||||
import {type User, WebStorageStateStore} from "oidc-client-ts";
|
import {type User, WebStorageStateStore} from "oidc-client-ts";
|
||||||
import { BrowserRouter } from "react-router";
|
import {BrowserRouter} from "react-router";
|
||||||
|
|
||||||
const onSigninCallback = (_user: User | void): void => {
|
const onSigninCallback = (_user: User | void): void => {
|
||||||
window.history.replaceState(
|
window.history.replaceState({}, document.title, window.location.pathname)
|
||||||
{},
|
|
||||||
document.title,
|
|
||||||
window.location.pathname
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const oidcConfig: AuthProviderProps = {
|
const oidcConfig: AuthProviderProps = {
|
||||||
authority: "https://sso.sr2.uk/realms/sr2",
|
authority: "https://sso.sr2.uk/realms/sr2",
|
||||||
client_id: "chris-dev",
|
client_id: "chris-dev",
|
||||||
redirect_uri: "http://localhost:5173",
|
redirect_uri: window.location.href,
|
||||||
onSigninCallback: onSigninCallback,
|
onSigninCallback: onSigninCallback,
|
||||||
userStore: new WebStorageStateStore({ store: window.localStorage }),
|
userStore: new WebStorageStateStore({store: window.localStorage}),
|
||||||
};
|
};
|
||||||
|
|
||||||
createRoot(document.getElementById('root')!).render(
|
createRoot(document.getElementById('root')!).render(<StrictMode>
|
||||||
<StrictMode>
|
<AuthProvider {...oidcConfig}>
|
||||||
<AuthProvider {...oidcConfig}>
|
<BrowserRouter basename="/ui">
|
||||||
<BrowserRouter>
|
<App/>
|
||||||
|
</BrowserRouter>
|
||||||
<App />
|
</AuthProvider>
|
||||||
</BrowserRouter>
|
</StrictMode>,)
|
||||||
|
|
||||||
</AuthProvider>
|
|
||||||
</StrictMode>,
|
|
||||||
)
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import react from '@vitejs/plugin-react'
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
base: '/ui/',
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue