-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from lugvitc/main
Reopen recruitment
- Loading branch information
Showing
4 changed files
with
405 additions
and
343 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,57 @@ | ||
import { createBrowserRouter, createRoutesFromElements, Route, RouterProvider } from "react-router-dom" | ||
|
||
import Root from "./pages" | ||
import NavLayout from "./components/NavLayout" | ||
import Login from "./pages/login" | ||
// import Apply from "./pages/apply" | ||
import { useEffect, useState } from "react" | ||
import { supabase, SessionContext } from "./supabase" | ||
import { | ||
createBrowserRouter, | ||
createRoutesFromElements, | ||
Route, | ||
RouterProvider, | ||
} from "react-router-dom"; | ||
|
||
import Root from "./pages"; | ||
import NavLayout from "./components/NavLayout"; | ||
import Login from "./pages/login"; | ||
import Apply from "./pages/apply"; | ||
import { useEffect, useState } from "react"; | ||
import { supabase, SessionContext } from "./supabase"; | ||
// import Book from "./pages/book" | ||
import Level from "./pages/level" | ||
import Level from "./pages/level"; | ||
// import Result from "./pages/results" | ||
|
||
const router = createBrowserRouter( | ||
createRoutesFromElements( | ||
<> | ||
<Route element={<NavLayout />}> | ||
<Route path="/" element={<Root />} /> | ||
<Route path="auth" element={<Login />} /> | ||
{/* <Route path="apply" element={<Apply />} /> */} | ||
{/* <Route path="book" element={<Book />} /> */} | ||
<Route path="admin" element={<Level />} /> | ||
{/* <Route path="result" element={<Result />} /> */} | ||
</Route> | ||
</> | ||
) | ||
) | ||
createRoutesFromElements( | ||
<> | ||
<Route element={<NavLayout />}> | ||
<Route path="/" element={<Root />} /> | ||
<Route path="auth" element={<Login />} /> | ||
<Route path="apply" element={<Apply />} /> | ||
{/* <Route path="book" element={<Book />} /> */} | ||
<Route path="admin" element={<Level />} /> | ||
{/* <Route path="result" element={<Result />} /> */} | ||
</Route> | ||
</>, | ||
), | ||
); | ||
|
||
export default function App() { | ||
const [session, setSession] = useState<any>(null) | ||
|
||
// console.log("=======", session) | ||
|
||
useEffect(() => { | ||
// supabase.auth.getSession().then(({ data: { session } }) => setSession(session)) | ||
|
||
supabase.auth.onAuthStateChange((_event, session) => { setSession(session); console.log(_event, session) }) | ||
}, []) | ||
|
||
return ( | ||
<SessionContext.Provider value={session}> | ||
<RouterProvider router={router} /> | ||
</SessionContext.Provider> | ||
) | ||
const [session, setSession] = useState<any>(null); | ||
|
||
// console.log("=======", session) | ||
|
||
useEffect(() => { | ||
// supabase.auth.getSession().then(({ data: { session } }) => setSession(session)) | ||
|
||
supabase.auth.onAuthStateChange((_event, session) => { | ||
setSession(session); | ||
console.log(_event, session); | ||
}); | ||
}, []); | ||
|
||
return ( | ||
<SessionContext.Provider value={session}> | ||
<RouterProvider router={router} /> | ||
<div | ||
dangerouslySetInnerHTML={{ | ||
__html: "<!--It was always intentional-->", | ||
}} | ||
/> | ||
</SessionContext.Provider> | ||
); | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom/client' | ||
import App from './App.tsx' | ||
import React from "react"; | ||
import ReactDOM from "react-dom/client"; | ||
import App from "./App.tsx"; | ||
|
||
import './reset.css'; | ||
import './main.css' | ||
import "./reset.css"; | ||
import "./main.css"; | ||
|
||
ReactDOM.createRoot(document.getElementById('root')!).render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode>, | ||
) | ||
ReactDOM.createRoot(document.getElementById("root")!).render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode>, | ||
); |
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
Oops, something went wrong.