Posts

Showing posts with the label redux-observable

Multipe ajax calls in parallel and dispatching redux actions after success leads to “Uncaught Error: Actions must be plain objects”

Multipe ajax calls in parallel and dispatching redux actions after success leads to “Uncaught Error: Actions must be plain objects” I am new to rxjs and redux-observable. Trying to create an epic that allows me to do multiple parallel ajax calls and dispatches respective actions on success: const loadPosters = (action$) => action$.pipe( ofType(Types.LOAD_FILMS_SUCCESS), switchMap(({ films }) => forkJoin(films.map(film => ajax .getJSON(`https://api.themoviedb.org/3/search/movie?query=${film.title}`) .pipe( map(response => { const [result] = response.results; const poster = `http://image.tmdb.org/t/p/w500/${result.poster_path}`; return Creators.savePoster(film, poster); }) ), )) ), ); Creators.savePoster() is an action creator for an action named SAVE_POSTER . But, whenever i run my application, no such action is dispatched. Instead i get an error message in browser console: Creators.savePost...