How can I return from a callback in an Angular5 effect?
How can I return from a callback in an Angular5 effect? @Effect() /* sends request to httpService with params as login credentials on instance of loginAction. */ login$: Observable<Action> = this.actions$ .instanceOf(LoginActions.LoginAction) .switchMap( action => { return this.loginHttpService.login(action.payload) .map( (res: any) => { if (res && res.message !== 'Invalid Login') { const firstName = res.firstName; const lastName = res.lastName; this.tokenService.setToken(res.jwt); this.tokenService.setFirstName(firstName.charAt(0).toUpperCase() + firstName.slice(1)); this.tokenService.setLastName(lastName.charAt(0).toUpperCase() + lastName .slice(1)); this.tokenService.setId(res.id); this.tokenService.setAvatar(firstName.charAt(0).toUpperCase() + lastName.charAt(0).toUpperCase()); c...
