SolidJSS
SolidJSβ€’2y agoβ€’
8 replies
ish

useNavigate outside of router - for example on authentication faiures?

I have a file of functions for interacting with my backend, I'd like to consolidate some error handling there, for example, if there is an authentication failure, redirect.

But as these are not in a router, I can't useNavigate, even though all these functions are called from a component under a router.

Is there another strategy I can use here?
Was this page helpful?