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

HER-32 remove jwt at unauthorized response #32

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

mhope21
Copy link
Collaborator

@mhope21 mhope21 commented Dec 19, 2024

HER-32: Remove JWT At Unauthorized Response [FE]

Issue

https://raquelanaroman.atlassian.net/browse/HER-32

Ensure that each page calls an endpoint to verify the user; if the response is unauthorized, then remove JWT.

Changes

  • Create AuthContext that checks user against the /current_user endpoint.
  • If response is unauthorized, remove JWT, log out existing session.
  • Wrap application with the AuthContext.
  • Manage state through AuthContext for cleaner code.

Review Checklist

  • I have documented my code with code comments.

@mhope21
Copy link
Collaborator Author

mhope21 commented Dec 19, 2024

@raquii I realized that user data from current_user is necessary with the current setup, so I could not change the response to just status: :ok .

Copy link
Collaborator

@trca831 trca831 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@dewi-anggraini dewi-anggraini left a comment

Choose a reason for hiding this comment

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

looks great to me.

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