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

Fix frontend API call error handling #238

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

achen2401
Copy link
Contributor

@achen2401 achen2401 commented Feb 6, 2025

see Slack convo here

  • fix frontend error handling of API call by catching the error and behaving appropriately based error status.

User will be redirected and appropriate message will display if 403 error is raised. See screenshot:
Screenshot 2025-02-06 at 11 52 32 AM

export const HTTP_FORBIDDEN_STATUS_CODE = 403;
export const HTTP_UNAUTHORIZED_STATUS_CODE = 401;
export const FORBIDDEN_LOGOUT_URL = "/logout?forbidden=true";
export const UNAUTHORIZED_LOGOUT_URL = "/logout?unauthorized=true";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with your approach, but perhaps any flavor of status_code would be more flexible and require less change? /logout?status_code=403

Copy link
Member

@mcjustin mcjustin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to ensure that @lydiadr is okay with this verbiage: "Your account is not authorized for access, please contact an administrator"

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

Successfully merging this pull request may close these issues.

3 participants