Commits
Giuseppe Digilio authored c8a1fe08607
64 64 | // It means "reacts to this action but don't send another" |
65 65 | @Effect({dispatch: false}) |
66 66 | public authenticatedError: Observable<Action> = this.actions$ |
67 67 | .ofType(AuthActionTypes.AUTHENTICATED_ERROR) |
68 68 | .do((action: LogOutSuccessAction) => this.authService.removeToken()); |
69 69 | |
70 70 | @Effect() |
71 71 | public checkToken: Observable<Action> = this.actions$ |
72 72 | .ofType(AuthActionTypes.CHECK_AUTHENTICATION_TOKEN) |
73 73 | .switchMap(() => { |
74 - | return this.authService.checkAuthenticationToken() |
74 + | return this.authService.hasValidAuthenticationToken() |
75 75 | .map((token: AuthTokenInfo) => new AuthenticatedAction(token)) |
76 76 | .catch((error) => Observable.of(new CheckAuthenticationTokenErrorAction())); |
77 77 | }); |
78 78 | |
79 79 | @Effect() |
80 80 | public createUser: Observable<Action> = this.actions$ |
81 81 | .ofType(AuthActionTypes.REGISTRATION) |
82 82 | .debounceTime(500) // to remove when functionality is implemented |
83 83 | .switchMap((action: RegistrationAction) => { |
84 84 | return this.authService.create(action.payload) |