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

task/WG-219: Adding GET hook for grabbing the username #198

Merged
merged 3 commits into from
Jan 26, 2024

Conversation

tjgrafft
Copy link
Contributor

@tjgrafft tjgrafft commented Jan 22, 2024

Overview:

Add react-query GET in our react/src/hooks to get user name

PR Status:

  • Ready.
  • Work in Progress.
  • Hold.

Related Jira tickets:

Summary of Changes:

  • Added a useAuthenticatedUser hook to retrieve username from Tapis
  • Previously this was being done in redux
  • Added a custom transform option to the useGet params in request.ts. This will help us transform API responses into the desired structure in the future if we have another case where the response data (name) needs to be changed to something more descriptive for us (username).
  • Added some temp UI to showcase the useAuthenticatedUser hook in action. This can be seen on the Main Menu, welcoming the authenticated user. We will get rid of this once the Nav-bar and Project Listing PRs are merged into master.
  • Between this PR (WG-219) and WG-74, these two PRs will need to be combined in the near future. WG-74's MapModal needs to take advantage of this useAuthenticatedUsesr hook. Which also includes updating MapModal's unit test to get rid of redux and use this useName hook instead.

Testing Steps:

  1. Run npm ci and npm run dev
  2. Go to localhost:4200
  3. On the Main Menu you should see a "Welcome" message with your username, upon login
  4. Compare with screenshot below

UI Photos:

Screenshot 2024-01-22 at 2 56 04 PM

Notes:

@tjgrafft tjgrafft marked this pull request as ready for review January 22, 2024 21:18
@tjgrafft tjgrafft changed the title task/WG-219: Adding GET hook for grabbinig the username task/WG-219: Adding GET hook for grabbing the username Jan 22, 2024
Copy link
Collaborator

@nathanfranklin nathanfranklin left a comment

Choose a reason for hiding this comment

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

LGTM 👍

I just have two suggestions on name changes.

react/src/hooks/user/useName.ts Outdated Show resolved Hide resolved
react/src/types/auth.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@nathanfranklin nathanfranklin left a comment

Choose a reason for hiding this comment

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

LGTM; Just one suggestion

react/src/requests.ts Show resolved Hide resolved
react/src/requests.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@nathanfranklin nathanfranklin 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
Contributor

@shayanaijaz shayanaijaz left a comment

Choose a reason for hiding this comment

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

LGTM

@tjgrafft tjgrafft merged commit 2643e39 into master Jan 26, 2024
5 checks passed
@tjgrafft tjgrafft deleted the task/WG-219-get-username-hook branch January 26, 2024 22:04
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