Skip to content

Commit

Permalink
fix(auth): addressing observable errors in non-browser environments (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdaniels committed Oct 30, 2020
1 parent 082c0de commit 120c854
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/auth/auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable, Inject, Optional, NgZone, PLATFORM_ID } from '@angular/core';
import { Observable, of, from } from 'rxjs';
import { switchMap, map, observeOn, shareReplay, first, tap } from 'rxjs/operators';
import { switchMap, map, observeOn, shareReplay, first } from 'rxjs/operators';
import {
FIREBASE_OPTIONS,
FIREBASE_APP_NAME,
Expand Down Expand Up @@ -76,13 +76,13 @@ export class AngularFireAuth {
const _ = auth.pipe(first()).subscribe();

this.authState = auth.pipe(
switchMap(auth => auth.getRedirectResult().then(() => auth)),
switchMap(auth => auth.getRedirectResult().then(() => auth, () => auth)),
switchMap(auth => zone.runOutsideAngular(() => new Observable<firebase.User|null>(auth.onAuthStateChanged.bind(auth)))),
keepUnstableUntilFirst
);

this.user = auth.pipe(
switchMap(auth => auth.getRedirectResult().then(() => auth)),
switchMap(auth => auth.getRedirectResult().then(() => auth, () => auth)),
switchMap(auth => zone.runOutsideAngular(() => new Observable<firebase.User|null>(auth.onIdTokenChanged.bind(auth)))),
keepUnstableUntilFirst
);
Expand Down

0 comments on commit 120c854

Please sign in to comment.