Created
August 27, 2019 19:24
-
-
Save brunoksato/5ff66fb43f09eb2df5e554acbaf052d5 to your computer and use it in GitHub Desktop.
xdxd
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
import React, { useEffect } from "react" | |
import Keycloak from 'keycloak-js'; | |
import { KeycloakProvider } from 'react-keycloak'; | |
import { Router } from "@reach/router" | |
import Home from "./index" | |
import Login from "./login" | |
import PrivateRoute from '../components/PrivateRoute' | |
const keycloakProviderInitConfig = { | |
onLoad: 'check-sso', | |
}; | |
let keycloak | |
const App = () => { | |
useEffect(() => { | |
keycloak = new Keycloak('./keycloak.json'); | |
}, []) | |
return ( | |
<KeycloakProvider | |
keycloak={keycloak} | |
initConfig={keycloakProviderInitConfig} | |
> | |
<Router> | |
<PublicRoute path="/"> | |
<Home path="/" /> | |
<Login path="/login" /> | |
</PublicRoute> | |
</Router> | |
</KeycloakProvider> | |
) | |
} | |
function PublicRoute(props) { | |
return <div>{props.children}</div> | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment