0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Added handling for unsuccessful comments API requests

refs https://github.com/TryGhost/Team/issues/2082

- in the event the API doesn't return a 200 OK, we shouldn't be
  processing the response from it, as we can end up doing weird things
  if, for example, an error object is returned
This commit is contained in:
Daniel Lockyer 2022-10-17 11:28:53 +07:00 committed by Daniel Lockyer
parent fd9401503b
commit 1dab16c9c1

View file

@ -76,6 +76,10 @@
body: JSON.stringify({ids})
});
if (rawRes.status !== 200) {
return;
}
const res = await rawRes.json();
for (const [id, count] of Object.entries(res)) {