import React from "react";
import { ReactKeycloakProvider } from "@react-keycloak/web";
import keycloak from "./keycloak"
import { BrowserRouter, Route, Routes } from "react-router-dom";
import Nav from "./components/nav";
import WelcomePage from "./pages/home";
import FooPage from "./pages/foo";
import SecuredPage from "./pages/secured";
import PrivateRoute from "./helpers/private-route";

function App() {
 return (
   <div>
     <ReactKeycloakProvider authClient={keycloak}>
       <Nav />
       <BrowserRouter>
         <Routes>
             <Route exact path="/" element={<WelcomePage />} />
	     <Route exact path="/foo" element={<FooPage />} />
           <Route
             path="/secured"
             element={
               <PrivateRoute>
                 <SecuredPage />
               </PrivateRoute>
             }
           />
         </Routes>
       </BrowserRouter>
       </ReactKeycloakProvider>
   </div>
 );
}

export default App;
