i have an issue with my oauth setup, when i logout with this effect:
@Effect()
logout: Observable<Action> = this.actions.ofType(UserActions.LOGOUT)
.switchMap(() => Observable.of(this.afAuth.auth.signOut()))
.map(() => new UserActions.GetUser())
.catch(err => Observable.of(new UserActions.AuthError({error: err.message})));
Everything works fine and the UserActions.GetUser()
is being called. Now if i try to log in with this effect and this firebase auth function:
@Effect()
googleLogin: Observable<Action> = this.actions.ofType(UserActions.GOOGLE_LOGIN)
.switchMap(() => Observable.fromPromise(this.loginWithGoogle()))
.map(() => new UserActions.GetUser())
.catch(err => Observable.of(new UserActions.AuthError({error: err.message})));
private loginWithGoogle() {
return this.afAuth.auth.signInWithPopup(new firebase.auth.GoogleAuthProvider());
}
The new UserActions.GetUser()
is called and i can see it in the Redux DevTools, but the actual effect is not called, i put a lot of console.log's in there to see if i did something wrong in the function, but it isn't called at all and also i have a catch
in the GetUser
, but that's also not triggering.
Is there some issue with firebase in this case or am i stupid?
Actions:
Get User effect:
@Effect()
getUser: Observable<Action> = this.actions.ofType(UserActions.GET_USER)
.switchMap(() => {
console.log('test'); // <-- Not called
return this.afAuth.authState;
})
.map(()=> {
return new UserActions.Authenticated();
});
** EDIT 1
I made a new observation: When there is no internet connection anymore, so firebase loads from local, it actually works, somehow there is an issue with the connection to the firebase database