mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix(site): add search params to auth redirect (#9005)
This commit is contained in:
@@ -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 }} />
|
||||
|
||||
Reference in New Issue
Block a user