Skip to content

Commit 0fe7c46

Browse files
committed
tidy: refactor
1 parent 95d406a commit 0fe7c46

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/api/prices/getPythPrices.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,18 @@ export default async function fetchPythPrices(priceFeedIds: string[], assets: As
1818
try {
1919
const pythResponse: PythPriceData[] = await cacheFn(
2020
async () => {
21-
let response = null
22-
2321
try {
24-
response = await fetchWithTimeout(pricesUrl.toString(), FETCH_TIMEOUT).then((res) =>
22+
return await fetchWithTimeout(pricesUrl.toString(), FETCH_TIMEOUT).then((res) =>
2523
res.json(),
2624
)
27-
return response
2825
} catch (error) {
2926
console.warn('Primary Pyth API failed, falling back to fallback API')
3027
}
3128

3229
try {
33-
response = await fetchWithTimeout(fallbackUrl.toString(), FETCH_TIMEOUT).then((res) =>
30+
return await fetchWithTimeout(fallbackUrl.toString(), FETCH_TIMEOUT).then((res) =>
3431
res.json(),
3532
)
36-
return response
3733
} catch (error) {
3834
console.error('Fallback Pyth API also failed')
3935
setApiError(fallbackUrl.toString(), error)

0 commit comments

Comments
 (0)