TanStackT
TanStack3y ago
4 replies
popular-magenta

Getting the destination url in the loader to throw a redirect

When you are throwing a redirect in a Route loader, is there any built-in way to get a string with the intended destination (path + search params) for the current Route?

The use-case here is an auth scenario where I'd place a string in a redirect_url search params to navigate to once auth is completed or on oauth2 callback.

Or should I just be creating this myself by parsing window.location into a string?
Was this page helpful?