From 741d54b9941ff18d438cd7c9c4ed6d1783c8a0b8 Mon Sep 17 00:00:00 2001 From: giancarlo Date: Mon, 13 May 2024 14:43:51 +0700 Subject: [PATCH] Handle API error in team account retrieval This update adds error handling for the API call in 'join' page while retrieving the team account information. If the call fails, it will catch the error and return undefined avoiding potential crashes. --- apps/web/app/join/page.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/web/app/join/page.tsx b/apps/web/app/join/page.tsx index 96ebf62eb..54395dd5b 100644 --- a/apps/web/app/join/page.tsx +++ b/apps/web/app/join/page.tsx @@ -70,7 +70,9 @@ async function JoinTeamAccountPage({ searchParams }: Context) { // we need to verify the user isn't already in the account // we do so by checking if the user can read the account // if the user can read the account, then they are already in the account - const account = await api.getTeamAccountById(invitation.account.id); + const account = await api + .getTeamAccountById(invitation.account.id) + .catch(() => undefined); // if the user is already in the account redirect to the home page if (account) {