redux-observable

You provided `undefined` where a stream was expected in Redux Observable

那年仲夏 提交于 2020-06-16 17:17:49
问题 Trying to wrap my head around RxJS and redux observable I have this: export const getSomeData = (action$) => action$.pipe( ofType(GET_USER_DATA), mergeMap((action) => getData(action.id)), map(fetchUserFulfilled), catchError((e) => of({ type: 'FAILED_TO_FETCH_DATA', e, }), ), ) which works good, but now I want to actually fire 2 observables when I get the data back so I tried this: export const getSomeData = (action$) => action$.pipe( ofType(GET_USER_DATA), mergeMap((action) => getData(action

You provided `undefined` where a stream was expected in Redux Observable

情到浓时终转凉″ 提交于 2020-06-16 17:17:38
问题 Trying to wrap my head around RxJS and redux observable I have this: export const getSomeData = (action$) => action$.pipe( ofType(GET_USER_DATA), mergeMap((action) => getData(action.id)), map(fetchUserFulfilled), catchError((e) => of({ type: 'FAILED_TO_FETCH_DATA', e, }), ), ) which works good, but now I want to actually fire 2 observables when I get the data back so I tried this: export const getSomeData = (action$) => action$.pipe( ofType(GET_USER_DATA), mergeMap((action) => getData(action

RX.JS Redux Observable Multiple Get requests at same time

蓝咒 提交于 2020-05-15 10:19:10
问题 I am trying to set up an observable that currently receives an array of location IDs and then makes a get request for all of these at once and waits for the response for them all. Here is a sample: const fetchPhotosEpic = action$ => action$.ofType(LOCATIONS_RECEIVED) .map(action => action.payload) .mergeMap((data) => { let promiseArray = data.map(location => Observable.fromPromise(axios.get(photosUrl(location.id)))) return Observable.forkJoin( promiseArray ) }) .map(responses => responses.map

RXJS redux observable perform multiple api calls

冷暖自知 提交于 2020-04-14 04:38:09
问题 I have an array of contacts and would like to perform an API calls for each object in the contacts array. I have tried to loop over each item and make the call to fetchJson$, however, I realise that this approach is incorrect. What is the correct way to do this with RXJS Redux Observables? Also, this is pseudo code for the purpose of this question so please ignore any syntax errors. export const createPost = (action$, store) => ( action$.ofType(UPDATE_USER_CONTACTS) .switchMap(() => { const

Facing issue while migrating angular 5 to angular 6 in .net core 2.1 project.

ⅰ亾dé卋堺 提交于 2020-03-05 08:04:42
问题 We are using angular SPA template. Facing issue while migrating angular 5 to angular 6 in .net core 2.1 project. For now I have updated packages, Old version package.json { "name": "projectname", "private": true, "version": "0.0.0", "scripts": { "test": "karma start ClientApp/test/karma.conf.js" }, "dependencies": { "@angular-redux/form": "^6.7.0", "@angular-redux/router": "^6.4.1", "@angular-redux/store": "6.6.0", "@angular/animations": "^5.2.0", "@angular/cli": "^7.1.2", "@angular/common":

Facing issue while migrating angular 5 to angular 6 in .net core 2.1 project.

倾然丶 夕夏残阳落幕 提交于 2020-03-05 08:04:28
问题 We are using angular SPA template. Facing issue while migrating angular 5 to angular 6 in .net core 2.1 project. For now I have updated packages, Old version package.json { "name": "projectname", "private": true, "version": "0.0.0", "scripts": { "test": "karma start ClientApp/test/karma.conf.js" }, "dependencies": { "@angular-redux/form": "^6.7.0", "@angular-redux/router": "^6.4.1", "@angular-redux/store": "6.6.0", "@angular/animations": "^5.2.0", "@angular/cli": "^7.1.2", "@angular/common":

Wait for sequence of action with a Redux Observable

百般思念 提交于 2020-02-17 05:00:42
问题 I have a use case where I need to wait for a sequence of actions before I dispatch another using Redux Observables. I've seen some similar questions but I cannot fathom how I can use these approaches for my given use case. In essence I want to do something like so: action$ .ofType(PAGINATION_CLICKED) // This action occurred. .ofType(FETCH_SUCCESS) // Then this action occurred after. .map(() => analyticsAction()); // Dispatch analytics. I would also like to cancel and start that sequence over

redux-observable return multiple action types

丶灬走出姿态 提交于 2020-02-08 09:47:11
问题 I am using redux-observable and this is what I am trying to do. When an actiontype of 'APPLY_SHOPPING_LIST' comes in dispatch 'APPLYING_SHOPPING_LIST' and after 5 seconds dispatch 'APPLIED_SHOPPING_LIST'. This is the code that I have come up with so far const applyingShoppingListSource = action$.ofType('APPLY_SHOPPING_LISTS').mapTo({ type: 'APPLYING_SHOPPING_LISTS' }); const applyingShoppingListSourceOther = action$.ofType('APPLY_SHOPPING_LISTS').mapTo({ type: 'APPLIED_SHOPPING_LISTS' })