added refresh token when check on authorization cookie is successful

This commit is contained in:
Giuseppe Digilio
2020-01-17 11:09:41 +01:00
parent 49e59c44e1
commit afe70bc546
4 changed files with 14 additions and 13 deletions

View File

@@ -2,11 +2,9 @@ import { Observable, of as observableOf } from 'rxjs';
import { catchError, debounceTime, filter, map, switchMap, take, tap } from 'rxjs/operators';
import { Injectable } from '@angular/core';
// import @ngrx
import { Actions, Effect, ofType } from '@ngrx/effects';
import { Action, select, Store } from '@ngrx/store';
// import services
import { AuthService } from './auth.service';
// import actions
@@ -99,8 +97,7 @@ export class AuthEffects {
return this.authService.checkAuthenticationCookie().pipe(
map((response: AuthStatus) => {
if (response.authenticated) {
this.authService.storeToken(response.token);
return new AuthenticatedAction(response.token);
return new RefreshTokenAction(null);
} else {
return new RetrieveAuthMethodsAction(response);
}