簡體   English   中英

如何在 redux-observable 上進行 PUT 和 DELETE

[英]How to make PUT and DELETE on redux-observable

我可以使用 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM