Created
December 3, 2018 09:35
-
-
Save wojtek1150/84123e7764562cf726c92bb09b0ed06e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@Effect() | |
authenticateUser$ = this.actions$ | |
.pipe( | |
ofType(authActions.AUTHENTICATE_USER), | |
switchMap(() => { | |
return this.angularFireAuth.authState.pipe( | |
map((identity: fromFirebase.User) => { | |
return identity | |
? new authActions.AuthenticateUserSuccess(ConvertingHelper.extractFirebaseUserInfo(identity)) | |
: new authActions.AuthenticateUserFail('User Not logged In.'); | |
}), | |
catchError(error => of(new authActions.AuthenticateUserFail(error))) | |
); | |
}) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment