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

refactor(auth.client): (5, final) extract get current logged in user service function to Typescript #2091

Merged
merged 5 commits into from
Jun 10, 2021

Conversation

karrui
Copy link
Contributor

@karrui karrui commented Jun 7, 2021

Chain: sendOtp <--- verifyOtp <-- fetchUser <- logout <-- getUserFromLocalStorage (you are here)

Problem

This PR is part 5 (and the final part) of migrating auth.client.js to Typescript. This PR extracts out the get current logged in admin user function

Related to #2057

Solution

Breaking Changes

  • Yes - this PR contains breaking changes
  • No - this PR is backwards compatible

Features:

  • feat(UserService): add getUserFromLocalStorage function
  • ref: replace all instances of Auth.getUser with UserService equivalent
  • feat: delete (now) unused auth.client.service.js

Tests

Unit tests have been written for UserService#getUserFromLocalStorage function.

Manual tests

  • Open avatar dropdown. Should load current user successfully.
  • Open edit contact number modal. Should load current user successfully.
  • Look at Google Analytics when you have downloaded a storage mode form responses. The label should be ${params.formTitle} (${params.formId}), ${<your email>}
  • In your admin form, go to the share form page. There should be a "use go link" lightbulb tooltip thingy
  • Should be able to successfully view admin form page (of your form) when logged in
  • Should be able to successfully view the edit form field modal successfully when logged in
  • Should be able to view form dashboard successfully when logged in
  • Should be able to view form settings successfully when logged in
  • Should be able to view examples page successfully when logged in
  • Should be able to view billing page successfully when logged in
  • In an admin form page, delete the user object from localStorage.
    • Should be logged out and redirected to the login page
    • After login, should be redirected back to the admin form page where you deleted the localStorage user.

@karrui karrui force-pushed the feat/authservice-logout-ts branch from 91f668a to 011b044 Compare June 8, 2021 03:24
@karrui karrui force-pushed the feat/authservice-getuser-ts branch from e2f8d5a to 4068740 Compare June 8, 2021 03:24
@karrui karrui force-pushed the feat/authservice-logout-ts branch from 011b044 to 9be3c54 Compare June 8, 2021 03:43
@karrui karrui force-pushed the feat/authservice-getuser-ts branch from 4068740 to a99f762 Compare June 8, 2021 03:43
@karrui karrui requested a review from tshuli June 9, 2021 02:51
@karrui karrui force-pushed the feat/authservice-getuser-ts branch from a99f762 to 42ae88b Compare June 9, 2021 07:07
@karrui karrui force-pushed the feat/authservice-logout-ts branch from 9be3c54 to 4b50c69 Compare June 9, 2021 07:08
Base automatically changed from feat/authservice-logout-ts to feat/authsvc-ts-base June 10, 2021 05:11
@karrui karrui force-pushed the feat/authservice-getuser-ts branch from 42ae88b to 62b4e23 Compare June 10, 2021 05:11
@karrui karrui merged commit 279bce5 into feat/authsvc-ts-base Jun 10, 2021
@karrui karrui deleted the feat/authservice-getuser-ts branch June 10, 2021 06:14
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.

2 participants