Skip to content

Commit c5035a7

Browse files
refactor: simplify API fetch error handling in aa-chains route
1 parent 50f98d7 commit c5035a7

File tree

1 file changed

+2
-12
lines changed
  • apps/portal/src/app/api/aa-chains

1 file changed

+2
-12
lines changed

apps/portal/src/app/api/aa-chains/route.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,12 @@ export async function GET() {
1414
headers: {
1515
"Content-Type": "application/json",
1616
},
17-
})
18-
.then((res) => res.json() as Promise<ApiResponseType>)
19-
.catch((error) => {
20-
console.error(error);
21-
return { data: {} as ApiResponseType["data"] };
22-
}),
17+
}).then((res) => res.json() as Promise<ApiResponseType>),
2318
fetch("https://api.thirdweb.com/v1/chains", {
2419
headers: {
2520
"Content-Type": "application/json",
2621
},
27-
})
28-
.then((res) => res.json() as Promise<{ data: ChainMetadata[] }>)
29-
.catch((error) => {
30-
console.error(error);
31-
return { data: [] as ChainMetadata[] };
32-
}),
22+
}).then((res) => res.json() as Promise<{ data: ChainMetadata[] }>),
3323
]);
3424

3525
const aaChains = Object.entries(chainsWithServices.data)

0 commit comments

Comments
 (0)