T
TanStack6mo ago
magic-amber

Route Check - Redirect

Hi all. Have to ask here - since I think I'm missing it in the docs... I wanted to ask if I can somehow check if the trigerred route was redirected to or was it a direct URL input? I would love to make sure that the route was redirected to and not manually triggered. Cheers!
3 Replies
optimistic-gold
optimistic-gold6mo ago
out of interest, why would that make a difference? and what happens if, after a redirect, the user refreshes the page?
magic-amber
magic-amberOP6mo ago
The page would check if the page was redirected to. If not I send the user to another page. I’m assuming now that the router state is not preserved when reloading the page. If state is preserved I would also add a state to check if the action was alredy done. If not I would keep them on the page else away they go.
optimistic-gold
optimistic-gold6mo ago
router.state.redirect should have the info you are looking for

Did you find this page helpful?