2

PHOTO EMBED

Sun Oct 16 2022 11:44:55 GMT+0000 (Coordinated Universal Time)

Saved by @Vrushabh_123

// read location and supply in requireAuth
let location = useLocation()
;<Navigate to='/login' state={{ from: location }} replace />

// use navigate in login to redirect after login
let navigate = useNavigate()
let from = location.state?.from?.pathname || '/'
navigate(from, { replace: true })
content_copyCOPY