[英]How to make PUT and DELETE on redux-observable
I'm able to do GET and POST call using redux-observable but not sure how to do PUT and DELETE with it, please find below my sample code, with syntax for GET and POST(commented)我可以使用 redux-observable 进行 GET 和 POST 调用,但不确定如何使用它进行 PUT 和 DELETE,请在我的示例代码下方找到 GET 和 POST 的语法(注释)
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,但根据我的项目配置以不同的方式
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.