From 48d77d208e14df9c9b390b8bcacad52b239dbadf Mon Sep 17 00:00:00 2001 From: James Grugett Date: Fri, 7 Oct 2022 16:59:16 -0500 Subject: [PATCH] mqp review: Use console.error if !response.ok --- functions/src/update-metrics.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/functions/src/update-metrics.ts b/functions/src/update-metrics.ts index 30b6231c..887dbbdc 100644 --- a/functions/src/update-metrics.ts +++ b/functions/src/update-metrics.ts @@ -35,9 +35,12 @@ export const updateMetrics = functions.pubsub }, method: 'POST', body: JSON.stringify({}), - }).then((res) => res.json()) + }) - console.log(await response) + const json = await response.json() + + if (response.ok) console.log(json) + else console.error(json) }) export const updatemetrics = newEndpointNoAuth(