Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set login/home pages to show on root endpoint #67

Merged
merged 2 commits into from
Jul 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions nepalingo-web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
} from "react-router-dom";
import User_auth from "./components/userAuth/UserAuth";
import Home from "./pages/Home/Home";
import Header from "./components/Header";
import supabase from "./components/userAuth/supabaseClient";

const App: React.FC = () => {
Expand Down Expand Up @@ -39,11 +38,10 @@ const App: React.FC = () => {
return (
<Router>
<Routes>
<Route path="/" element={<Header />} />
<Route path="/login" element={<User_auth />} />
{/* Protect the /home route, redirect to /login if not authenticated */}
{/* Protect the / route, redirect to /login if not authenticated */}
<Route
path="/home"
path="/"
element={isAuthenticated ? <Home /> : <Navigate to="/login" />}
/>
{/* Default route redirects to /login */}
Expand Down
Loading