diff --git a/src/CONST.ts b/src/CONST.ts index 86cbd4c28fc9..313bcdf9fb70 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1151,7 +1151,6 @@ const CONST = { BAD_REQUEST: 400, NOT_AUTHENTICATED: 407, EXP_ERROR: 666, - MANY_WRITES_ERROR: 665, UNABLE_TO_RETRY: 'unableToRetry', UPDATE_REQUIRED: 426, }, diff --git a/src/libs/HttpUtils.ts b/src/libs/HttpUtils.ts index 550a75c3d361..de6aea96cb47 100644 --- a/src/libs/HttpUtils.ts +++ b/src/libs/HttpUtils.ts @@ -130,15 +130,12 @@ function processHTTPRequest(url: string, method: RequestType = 'get', body: Form }); } - if (response.jsonCode === CONST.JSON_CODE.MANY_WRITES_ERROR) { - if (response.data) { - const {phpCommandName, authWriteCommands} = response.data; - // eslint-disable-next-line max-len - const message = `The API call (${phpCommandName}) did more Auth write requests than allowed. Count ${authWriteCommands.length}, commands: ${authWriteCommands.join( - ', ', - )}. Check the APIWriteCommands class in Web-Expensify`; - alert('Too many auth writes', message); - } + if (response.data && (response.data?.authWriteCommands?.length ?? 0)) { + const {phpCommandName, authWriteCommands} = response.data; + const message = `The API command ${phpCommandName} is doing too many Auth writes. Count ${authWriteCommands.length}, commands: ${authWriteCommands.join( + ', ', + )}. If you modified this command, you MUST refactor it to remove the extra Auth writes. Otherwise, update the allowed write count in Web-Expensify APIWriteCommands.`; + alert('Too many auth writes', message); } if (response.jsonCode === CONST.JSON_CODE.UPDATE_REQUIRED) { // Trigger a modal and disable the app as the user needs to upgrade to the latest minimum version to continue