fix(site): add search params to auth redirect (#9005)

This commit is contained in:
Bruno Quaresma
2023-08-09 16:31:12 -03:00
committed by GitHub
parent 53f26b313d
commit 5b9dc2ee8b
@@ -10,7 +10,9 @@ export const RequireAuth: FC = () => {
const [authState] = useAuth()
const location = useLocation()
const isHomePage = location.pathname === "/"
const navigateTo = isHomePage ? "/login" : embedRedirect(location.pathname)
const navigateTo = isHomePage
? "/login"
: embedRedirect(`${location.pathname}${location.search}`)
if (authState.matches("signedOut")) {
return <Navigate to={navigateTo} state={{ isRedirect: !isHomePage }} />