1
0
Fork 0
mirror of synced 2024-10-01 17:47:46 +13:00

Fix recursion issue with applying API method patches

This commit is contained in:
Andrew Kingston 2022-01-20 11:26:43 +00:00
parent 1ec3a91cae
commit 6a07e727cd

View file

@ -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 })
}
})