New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating authorized route #119
Comments
To do that on a route, in We actually handle these cases a little differently, though – we throw If you don't want to attempt to fetch data, then you can also use a custom resolver that checks for auth status and throws the relevant exception before calling the base resolver. |
@taion Thanks for the reply. That is more of less what I was doing, and it seems very close to working. One thing I'm caught up on is that I still do want to have a route for |
Okay, I created a solution in which I have a Is it okay in your opinion to
Thanks again for your help! |
You shouldn’t return |
In your example of having both |
Thanks @taion! Would returning In any case, I'll change it to Makes sense re: login. I think I'm going to forego adding the login as an error, and keep it only as a route for now since I would have to add the routing logic anyway if I made it render only on errors (unless there are some benefits that I'm not seeing). Is it strange to be throwing 403 errors when it's a public page? |
In terms of errors, I don't know... maybe? If it's purely client-side, it's irrelevant since the error codes are just internal. If you're using those codes to drive response codes on the server, then I guess it is a little weird. You can always just render whatever you would from |
Got it, thanks for the info. Yeah it seems harmless, though a little annoying that those errors show up uncaught inside the console. |
Yeah – you're supposed to handle them for yourself in |
I'm trying to create a protected route that will redirect to
/login
when user is not authorized. I think this is more appropriate for Stack Overflow, here's the post. But wanted to post here as well.Is there a standard way of handling this situation?
The text was updated successfully, but these errors were encountered: