Skip to content

Commit

Permalink
Fix Vercel integration empty state (#1246)
Browse files Browse the repository at this point in the history
  • Loading branch information
djfarrelly committed Mar 22, 2024
1 parent a712533 commit 61717ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ export default function VercelIntegrationPage() {
);
}
if (error) {
throw error;
// HACK - This is a hack as we don't have error codes,
// match against the error message
if (!error.message.match(/(haven't integrated with Vercel yet)/gi)) {
console.log(error);
throw error;
}
}
return <VercelIntegrationForm vercelIntegration={data} />;
}
8 changes: 7 additions & 1 deletion ui/apps/dashboard/src/utils/useRestAPIRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ export function useRestAPIRequest<T>({
if (!response.ok || response.status >= 400) {
setData(null);
setIsLoading(false);
return setError(new Error(response.statusText));
try {
const data = await response.json();
const error = data.error || response.statusText;
return setError(new Error(error));
} catch (err) {
return setError(new Error(response.statusText));
}
}
const data = await response.json();

Expand Down

0 comments on commit 61717ce

Please sign in to comment.