Skip to content

Commit

Permalink
fix: add login redirect path
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyton505 committed Jan 9, 2025
1 parent df90a2d commit 12ce2c3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ import MenteeDashboard from "./pages/MenteeDashboard";
import CreateWorkshop from "./pages/CreateWorkshop";
import CreateMeeting from "./pages/CreateMeeting";
import AuthCallback from "./pages/auth-callback";
import LoginRedirect from "./pages/LoginRedirect";

function App(): ReactElement {
return (
<div className="App">
<Routes>
<Route path="/login" element={<LoginRedirect />} />
<Route path="/" element={<Home />} />
<Route path="/home" element={<Home />} />
<Route path="/mentor" element={<MentorDashboard />} />
<Route path="/mentee" element={<MenteeDashboard/>}/>
<Route path="/mentee" element={<MenteeDashboard />} />
<Route path="/create-workshop" element={<CreateWorkshop />} />
<Route path="/create-meeting" element={<CreateMeeting />} />
<Route path="/callback" element={<AuthCallback />} />
Expand Down
18 changes: 18 additions & 0 deletions app/src/pages/LoginRedirect.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { useEffect } from "react";
import { useAuth0 } from "@auth0/auth0-react";

const LoginRedirect = () => {
const { loginWithRedirect } = useAuth0();

useEffect(() => {
loginWithRedirect({
appState: {
returnTo: "/home",
},
});
}, [loginWithRedirect]);

return null;
};

export default LoginRedirect;

0 comments on commit 12ce2c3

Please sign in to comment.