Skip to content
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

Centralize error toast notification #165

Open
alexashley opened this issue Jul 23, 2021 · 1 comment
Open

Centralize error toast notification #165

alexashley opened this issue Jul 23, 2021 · 1 comment

Comments

@alexashley
Copy link
Contributor

alexashley commented Jul 23, 2021

Comes out of #164:

On the backend of rode-ui, we were able to proxy status codes with less explicit handling; however, adding a check for showing an unauthorized message meant lots of tedious checks that look like this on the front-end:

if (response.status === FORBIDDEN) {
   return showError(UNAUTHORIZED_ERROR_MESSAGE);
}

We're using fetch directly in a lot of places, might be desirable to pull that out into a single spot. There's a useFetch hook that might be the right spot, but all of the existing call sites would have to be updated.

This would also apply for showing a generic error message if the call fails for another reason.

@alexashley
Copy link
Contributor Author

This is also an issue when the user doesn't have a role that Rode recognizes -- passing this error along would be handy:

{"code":16,"message":"missing roles claim","details":[]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant