Open
Description
Trying to dispatch an Observable
export const fetchMetaDataLogic: Logic = createLogic({
type: fetchMetaData,
process: ({ getState, action }, dispatch, done) => {
const code: string = action.payload;
const ob$ = new Observable(obs => {
Promise.all([
apiService.get(code)
.then((resp: AxiosResponse) => resp.data),
apiService.getMeta()
.then((resp: AxiosResponse) => resp.data)
]).then(values => obs.complete()); // values dispatched
});
dispatch(ob$);
done();
}
});
Getting the Following Error.
Argument of type 'Observable<unknown>' is not assignable to parameter of type 'ArgumentAction<string, undefined, undefined>'.
Type 'Observable<unknown>' is not assignable to type 'ActionBasis<string> & Partial<ActionBasis<string> & { payload: object; } & { meta: object; } & { error?: false | undefined; }>'.
Property 'type' is missing in type 'Observable<unknown>' but required in type 'ActionBasis<string>'. TS2345
46 | ]).then(values => obs.complete()); // values dispatched
47 | });
> 48 | dispatch(ob$);
| ^
49 | done();
50 | }
51 | });
Metadata
Metadata
Assignees
Labels
No labels