This repository has been archived by the owner on Oct 14, 2022. It is now read-only.
generated from dalbitresb12/angular-starter
-
Notifications
You must be signed in to change notification settings - Fork 1
refactor(auth): full rewrite of AuthService #17
Merged
Merged
Conversation
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
* Extended BaseService and implemented auth-specific methods * Now it fetches from the API * Moved Projects to separate service
Deploying with
|
Latest commit: |
ce98520
|
Status: | ✅ Deploy successful! |
Preview URL: | https://e73db3c3.waw-frontend-angular.pages.dev |
* Pages that need access to the global User object must extend UseUser * The hook provides the object on a User property * Pages must implement OnInit and OnDestroy, which must call the provided methods * Sample implementations: SignIn and Profile components
AdrianAlzamoraG
approved these changes
May 19, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed changes
amenes12
approved these changes
May 19, 2022
gakol28
approved these changes
May 19, 2022
VivianMPQ
reviewed
May 19, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewed changes
VivianMPQ
approved these changes
May 19, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does it do
This PR is a full refactor of the AuthService so that it uses the HttpClient with fake logins from the mock API.
Usage
Add the AuthService wherever you need it to your constructor:
If you just need access to the User global state, please use the
UseUser
hook provided insrc/app/auth/hooks/use-user.ts
. You can see sample implementation of this hook in the Profile and SignIn component.This pull request also provided the initial implementation of the generic
BaseService
, which will be used for any new services implemented in the app. It provided generic implementation of CRUD operations for basic services, with the ability to create custom logic on each service with those base operations. You can see sample implementations of this onAuthService
andProjectsService
.Why is it needed
We'll use fake logins currently, but once the backend is fully implemented, we'll just switch to that.
Related issue(s)/PR(s)
Initial implementation: #6.