Skip to content

Commit

Permalink
Fix email verification routes
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolelim02 committed Oct 28, 2024
1 parent 9d79002 commit f79e30c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ function App() {
<Route index element={<Navigate to="/auth/login" />} />
<Route path="signup" element={<SignUp />} />
<Route path="login" element={<LogIn />} />
<Route
path="verifyEmail/:userId?"
element={<EmailVerification />}
/>
<Route path="verify-email">
<Route index element={<EmailVerification />} />
<Route path=":userId" element={<EmailVerification />} />
</Route>
<Route path="forget-password" element={<ForgetPassword />} />
<Route path="*" element={<Navigate to="/auth/login" />} />
</Route>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/contexts/AuthContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const AuthProvider: React.FC<{ children?: React.ReactNode }> = (props) => {
})
.then(() => userClient.post("users/send-verification-email", { email }))
.then((res) => {
navigate(`/auth/verifyEmail/${res.data.data.id}`);
navigate(`/auth/verify-email/${res.data.data.id}`);
})
.catch((err) => {
setUser(null);
Expand All @@ -88,7 +88,7 @@ const AuthProvider: React.FC<{ children?: React.ReactNode }> = (props) => {
})
.catch((err) => {
if (err.response?.data.message === "User not verified.") {
navigate(`/auth/verifyEmail`);
navigate(`/auth/verify-email`);
}
setUser(null);
toast.error(err.response?.data.message || err.message);
Expand Down

0 comments on commit f79e30c

Please sign in to comment.