Skip to content

Instantly share code, notes, and snippets.

@wojtek1150
Created December 3, 2018 09:35
Show Gist options
  • Save wojtek1150/84123e7764562cf726c92bb09b0ed06e to your computer and use it in GitHub Desktop.
Save wojtek1150/84123e7764562cf726c92bb09b0ed06e to your computer and use it in GitHub Desktop.
@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