From 4d58c278cacacc6867c62528349cda34390b2237 Mon Sep 17 00:00:00 2001 From: yu-zhen Date: Fri, 6 Dec 2024 02:05:10 +0900 Subject: [PATCH] fix: catch error for fetchTally function --- packages/interface/src/utils/fetchTally.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/interface/src/utils/fetchTally.ts b/packages/interface/src/utils/fetchTally.ts index 644519cb..7387c46e 100644 --- a/packages/interface/src/utils/fetchTally.ts +++ b/packages/interface/src/utils/fetchTally.ts @@ -48,7 +48,9 @@ export async function fetchTally(id: string): Promise { body: JSON.stringify({ query: tallyQuery.replace("id: $id", `id: "${id}"`), }), - }).then((response: GraphQLResponse) => response.data?.tally); + }) + .then((response: GraphQLResponse) => response.data?.tally) + .catch(() => undefined); } /** @@ -62,5 +64,7 @@ export async function fetchTallies(): Promise { body: JSON.stringify({ query: talliesQuery, }), - }).then((r) => r.data.tallies); + }) + .then((r) => r.data.tallies) + .catch(() => []); }