Skip to content

Commit

Permalink
Merge pull request #13 from mu373/feature/blockchain-info-api-fallback
Browse files Browse the repository at this point in the history
Set type assertion
  • Loading branch information
mu373 authored May 19, 2024
2 parents a52ace1 + 08d3eb8 commit 6276837
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ export const decimalFloor = (value: number, base: number) => {

export const fetchWithTimeout = async (url: string, timeout: number = 3000, options?: RequestInit): Promise<Response> => {
try {
const response: Response = await Promise.race([
const response = await Promise.race([
fetch(url, options),
new Promise((_, reject) =>
setTimeout(() => reject(new Error('Request timeout')), timeout)
),
]);
]) as Response; ;

if (response.ok) {
return response;
Expand Down

0 comments on commit 6276837

Please sign in to comment.