1
我的應用程序使用ngrx和ngrx效果。這裏是我的應用程序的影響之一:鏈接RxJS映射運算符和ngrx效果問題
@Effect()
reloadPersonalInfo$: Observable<Action> = this.actions$
.ofType(currentUserAccount.ActionTypes.RELOAD_PERSONAL_INFO)
.filter(() => <boolean>JSON.parse(localStorage.getItem('authenticated')))
.switchMap(() =>
this.userAccountService
.retrieveCurrentUserAccount()
.map(currentUserAccount => new LoadUserAccountAction(currentUserAccount))
.map(() => new SigninAction())
);
我很奇怪,爲什麼LoadUserAccountAction
沒有進入我的減速功能,如果我註釋掉//.map(() => new SigninAction())
任何人都可以請幫助除?我錯了什麼?
效果意味着只返回一個動作。 – Jim
@Jim:感謝您的評論和編輯。你能否建議一種方法來改變應用程序的設計,以避免返回幾個效果的行動? – balteo
您正試圖同時返回「LoadUserAccountAction」和「SigninAction」。你應該返回其中一個。換句話說,刪除代碼中的一行.map行。 – Jim