Skip to content

Commit

Permalink
Fixed url flickering (#423)
Browse files Browse the repository at this point in the history
* redirecting to homepage when user not logged in

* linting

* fixed url flickering
  • Loading branch information
AronBuzogany authored May 23, 2024
1 parent d3bcf1f commit dcb556f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions frontend/src/components/Header/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ export default function Layout(): JSX.Element {
!meData.loggedIn &&
!(
location.pathname === "/" ||
/\/([a-z]{2})?\/home/.test(location.pathname)
/\/([a-z]{2})\/home/.test(location.pathname) ||
location.pathname === `/${i18next.resolvedLanguage}`
)
) {
navigate("/");
navigate(`${i18next.resolvedLanguage}/home`);
}
}, [meData.loggedIn, location.pathname, navigate]);

Expand All @@ -54,4 +55,4 @@ const useEnsureLangCodeInPath = () => {
navigate(newPath);
}
}, [location, navigate]);
};
};

0 comments on commit dcb556f

Please sign in to comment.