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.
This commit is contained in:
giancarlo
2024-05-13 14:43:51 +07:00
parent f7be3e84f4
commit 741d54b994

View File

@@ -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) {