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): (2) extract verify otp flow to Typescript #2086

Merged
merged 12 commits into from
Jun 10, 2021

Conversation

karrui
Copy link
Contributor

@karrui karrui commented Jun 7, 2021

Chain: sendOtp <--- verifyOtp (you are here)

Problem

This PR is part 2 of migrating auth.client.js to Typescript. This PR extracts out the verify OTP function.

Related to #2057

Solution

Breaking Changes

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

Features:

  • feat(AuthService): add verifyLoginOtp fn
  • ref(AuthService): move User related fns to UserService
  • ref: rename Admin prefix to User prefix to better fit the backend API

Tests

  • add unit tests for verifyLoginOtp

Manual Tests

  • Reach verify OTP flow. Invalid OTP should be rejected. Valid OTP should succeed
  • On successful log in, the user object should be stored in localStorage

Deploy Notes

New dependencies:

New dev dependencies:

  • jest-localstorage-mock: mock localstorage in frontend jest tests

@karrui
Copy link
Contributor Author

karrui commented Jun 7, 2021

Failing on Typescript 4.3.x, see
colinhacks/zod#473
microsoft/TypeScript#44299

Will figure out alternatives or a TS downgrade

@karrui karrui changed the title refactor(auth.client): (2) extract verify otp flow to Typescript refactor(auth.client): (2) extract verify otp flow to Typescript, downgrade Typescript to 4.2 Jun 7, 2021
@karrui karrui changed the title refactor(auth.client): (2) extract verify otp flow to Typescript, downgrade Typescript to 4.2 refactor(auth.client): (2) extract verify otp flow to Typescript Jun 7, 2021
.vscode/settings.json Show resolved Hide resolved
src/types/api/user.ts Show resolved Hide resolved
src/types/api/agency.ts Show resolved Hide resolved
src/public/services/AuthService.ts Outdated Show resolved Hide resolved
src/public/services/AuthService.ts Show resolved Hide resolved
@karrui karrui force-pushed the feat/authservice-verify-userservice-ts branch from 94c0f3c to 5a03fa6 Compare June 8, 2021 03:07
@karrui karrui requested a review from mantariksh June 9, 2021 02:50
@karrui
Copy link
Contributor Author

karrui commented Jun 9, 2021

Ready for re-review

@karrui karrui requested a review from tshuli June 9, 2021 02:51
Base automatically changed from feat/authservice-sendloginotp-ts to develop June 9, 2021 06:50
@karrui karrui force-pushed the feat/authservice-verify-userservice-ts branch from 5a03fa6 to aa596c9 Compare June 9, 2021 06:54
@karrui karrui changed the base branch from develop to feat/authsvc-ts-base June 9, 2021 07:10
@karrui karrui merged commit f7a5dda into feat/authsvc-ts-base Jun 10, 2021
@karrui karrui deleted the feat/authservice-verify-userservice-ts branch June 10, 2021 05:10
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