如何将函数from / pipe添加到管道参数?

时间:2019-06-13 18:00:14

标签: javascript reactjs typescript pipe

我需要在管道中添加函数,但是它总是显示错误fn不是函数

const updateCodeEpic = action$ =>
    action$.pipe(
        ofType(UPDATE_REQUEST),
        switchMap(action =>
            from(AppointmentApi.updateCode(action.payload.model)).pipe(
                    map(data => ({ type: UPDATE_SUCCESS, result: {
                        id: action.payload.model.id
                    }})),
                    catchError(error => of({ type: UPDATE_FAILURE }, addErrorToast(error.data.errorMessage))),
                    myFunction(action)
                )
        )
    );

和我的功能

var myFunction = (action) => {from(Api.loadData(action.payload.model.id, null, true)).pipe(
    map(data => 
        ({ type: DATA_SUCCESS, items: data })
        )
    )}

0 个答案:

没有答案