简体   繁体   中英

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)

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,但根据我的项目配置以不同的方式

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM