forked from opengovsg/FormSG
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(auth.client.service): refactor to Typescript (opengovsg#2132)
* feat(AuthService): add verifyLoginOtp fn * ref: use AdminAuthService.verifyLoginOtp * ref: rename Admin to User better fit API prefix * ref(AuthService): move User related fns to UserService * test(AuthService): add unit tests for verifyLoginOtp * chore: add jest-localstorage-mock package for mocking localstorage in the frontend jest tests * test(UserService): add unit tests for saveUserToLocalStorage * chore: move date-fns from devDeps to deps * feat: add base typings for Agency and User in preparation for extending from to close opengovsg#2066 * feat: remove unused verifyOtp function * chore: set VSCode default TS version to follow node_modules * ref: move saveUserToLocalStorage responsibility to calling controller * feat(UserService): add fetchUser function * ref(avatar-dropdown.client): use UserService.fetchUser() * test(UserService): add unit tests for fetchUser * feat: remove unused refreshUser function * feat(UserService): add clearUserFromLocalStorage function (and tests) * feat: move responsibility of clearing user from localStorage to ctl * fix: correctly set truser when fetching user from server * ref: use UserService.saveUserToLocalStorage * feat(AuthService): add and use logout function * feat: remove unused Auth.signOut and setUser functions * test(AuthService): add unit test for logout test(UserService): add tests for clearUserFromLocalStorage * feat(UserService): add getUserFromLocalStorage function * ref: replace all instances of Auth.getUser with UserService equivalent * feat: delete unused auth.client.service.js * test(UserService): add unit tests for getUserFromLocalStorage * chore: run npm run lint i didn't even touch this part of the code...
- Loading branch information
Showing
26 changed files
with
387 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.