T
TanStack9mo ago
multiple-amethyst

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
inland-turquoise
inland-turquoise9mo ago
out of interest, why would that make a difference? and what happens if, after a redirect, the user refreshes the page?
multiple-amethyst
multiple-amethystOP9mo 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.
inland-turquoise
inland-turquoise9mo ago
router.state.redirect should have the info you are looking for

Did you find this page helpful?