From 58c5493ed3e221ab47771d82232eb2327bb6633b Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 25 Jan 2022 08:10:49 +0000 Subject: [PATCH] Fix custom API response parsing not working --- packages/frontend-core/src/api/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/frontend-core/src/api/index.js b/packages/frontend-core/src/api/index.js index 10a32f9d56..a2cd62f16a 100644 --- a/packages/frontend-core/src/api/index.js +++ b/packages/frontend-core/src/api/index.js @@ -83,6 +83,7 @@ export const createAPIClient = config => { body, json = true, external = false, + parseResponse, }) => { // Ensure we don't do JSON processing if sending a GET request json = json && method !== "GET" @@ -125,8 +126,8 @@ export const createAPIClient = config => { // Handle response if (response.status >= 200 && response.status < 400) { try { - if (config?.parseResponse) { - return await config.parseResponse(response) + if (parseResponse) { + return await parseResponse(response) } else { return await response.json() }