Skip to content

Commit

Permalink
frontend: skip landing page
Browse files Browse the repository at this point in the history
  • Loading branch information
NickSavage committed Nov 22, 2024
1 parent 57c581f commit 1da0616
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion zettelkasten-front/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React, { useEffect } from "react";
import { Admin } from "./pages/admin/AdminPage";
import LandingPage from "./landing/LandingPage";
import LoginForm from "./pages/LoginPage";
Expand All @@ -7,8 +7,19 @@ import RegisterPage from "./pages/RegisterPage";
import { Routes, Route } from "react-router-dom";
import PasswordReset from "./pages/PasswordReset";
import EmailValidation from "./pages/EmailValidation";
import { useAuth } from "./contexts/AuthContext";

import { useNavigate } from "react-router-dom";

function App() {
const navigate = useNavigate();
const { isAuthenticated } = useAuth();
useEffect(() => {
if (isAuthenticated && location.pathname === "/") {
navigate("/app");
}
}, [isAuthenticated, navigate]); // Add dependencies

return (
<div>
<Routes>
Expand Down

0 comments on commit 1da0616

Please sign in to comment.