Browse Source

Fix recursion issue with applying API method patches

pull/4223/head
Andrew Kingston 5 years ago
parent
commit
d0b645cf6e
  1. 3
      packages/frontend-core/src/api/index.js

3
packages/frontend-core/src/api/index.js

@ -179,8 +179,9 @@ export const createAPIClient = config => {
const patches = Object.entries(config.patches || {})
if (patches.length) {
patches.forEach(([method, fn]) => {
const baseFn = API[method]
API[method] = async (...params) => {
const output = await API[method](...params)
const output = await baseFn(...params)
return await fn({ params, output })
}
})

Loading…
Cancel
Save