Skip to content

Commit

Permalink
Avoid short 404 before login redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Oct 10, 2024
1 parent b241d34 commit 9e7effc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/src/pages/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ export const App = () => {
navigate("/missingAttributes");
return;
}
setLoading(false);
const pathname = localStorage.getItem("location") || window.location.pathname;
const isInvitationAcceptFlow = window.location.pathname.startsWith("/invitation/accept");
if (res.name && !pathname.startsWith("/invitation/accept") && !isInvitationAcceptFlow) {
setLoading(false);
navigate("/deadend");
} else if (pathname === "/" || pathname.startsWith("/login") || pathname.startsWith("/invitation/accept") || isInvitationAcceptFlow) {
setLoading(false);
navigate(isInvitationAcceptFlow ? (window.location.pathname + window.location.search) : pathname);
} else {
//Bookmarked URL's trigger a direct login and skip the landing page
Expand Down

0 comments on commit 9e7effc

Please sign in to comment.