如何在 redux-observable 上进行 PUT 和 DELETE
How to make PUT and DELETE on redux-observable
我可以使用 redux-observable 进行 GET 和 POST 调用,但不确定如何使用它进行 PUT 和 DELETE,请在下面找到我的示例代码,其中包含 GET 和 [=13 的语法=](评论)
export const testEpic: Epic<Action, ReduxState> = (
action$: ActionsObservable<any>,
store: MiddlewareAPI<any, ReduxState>,
{ testAPI }: EpicDependencies
) =>
action$
.ofType(TEST_GET)
.mergeMap((action) => {
return Observable.merge(
testAPI
.getJSON('/path/test-data')
//.postJSON(/path/test-post, payload)
.mergeMap((response) => {
// Code
})
)
}
)
.catch((error) => {
return Observable.of(errorAction(error))
})
我修复了它,仅使用简单的 PUT 和 DELETE,但根据我的项目配置以不同的方式修复
我可以使用 redux-observable 进行 GET 和 POST 调用,但不确定如何使用它进行 PUT 和 DELETE,请在下面找到我的示例代码,其中包含 GET 和 [=13 的语法=](评论)
export const testEpic: Epic<Action, ReduxState> = (
action$: ActionsObservable<any>,
store: MiddlewareAPI<any, ReduxState>,
{ testAPI }: EpicDependencies
) =>
action$
.ofType(TEST_GET)
.mergeMap((action) => {
return Observable.merge(
testAPI
.getJSON('/path/test-data')
//.postJSON(/path/test-post, payload)
.mergeMap((response) => {
// Code
})
)
}
)
.catch((error) => {
return Observable.of(errorAction(error))
})
我修复了它,仅使用简单的 PUT 和 DELETE,但根据我的项目配置以不同的方式修复