mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
@@ -13,10 +13,9 @@ export const RequireAuth: React.FC<RequireAuthProps> = ({ children }) => {
|
||||
const xServices = useContext(XServiceContext)
|
||||
const [authState] = useActor(xServices.authXService)
|
||||
const location = useLocation()
|
||||
const redirectTo = embedRedirect(location.pathname)
|
||||
|
||||
const navigateTo = location.pathname === "/" ? "/login" : embedRedirect(location.pathname)
|
||||
if (authState.matches("signedOut")) {
|
||||
return <Navigate to={redirectTo} />
|
||||
return <Navigate to={navigateTo} />
|
||||
} else if (authState.hasTag("loading")) {
|
||||
return <FullScreenLoader />
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user