remove all instances of first as it can cause an error if it's never triggered

This commit is contained in:
Art Lowel
2018-12-19 14:53:11 +01:00
parent e2a6db3679
commit 9911578bcc
12 changed files with 44 additions and 28 deletions

View File

@@ -47,7 +47,7 @@ export class AuthEffects {
ofType(AuthActionTypes.AUTHENTICATE),
switchMap((action: AuthenticateAction) => {
return this.authService.authenticate(action.payload.email, action.payload.password).pipe(
first(),
take(1),
map((response: AuthStatus) => new AuthenticationSuccessAction(response.token)),
catchError((error) => observableOf(new AuthenticationErrorAction(error)))
);
@@ -127,7 +127,7 @@ export class AuthEffects {
switchMap(() => {
return this.store.pipe(
select(isAuthenticated),
first(),
take(1),
filter((authenticated) => !authenticated),
tap(() => this.authService.removeToken()),
tap(() => this.authService.resetAuthenticationError())