Skip to content

Commit 89c31bb

Browse files
committed
Merge branch 'master' into chore/dont-seed-prod
2 parents fe3f832 + 6b470fb commit 89c31bb

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

services/priceService.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,14 @@ export async function getPriceForDayAndNetworkTicker (day: moment.Moment, networ
111111
}
112112

113113
function isResponseAsExpected (data: any): boolean {
114-
return data.Price_in_CAD !== undefined && data.Price_in_USD !== undefined
114+
const isExpectedObj = data.Price_in_CAD !== undefined && data.Price_in_USD !== undefined
115+
if (isExpectedObj) return true
116+
const values = Object.values(data) as unknown as any[]
117+
if (values.length > 0) {
118+
const firstValueIsExpectedObj = values[0].Price_in_CAD !== undefined && values[0].Price_in_USD !== undefined
119+
if (firstValueIsExpectedObj) return true
120+
}
121+
return false
115122
}
116123

117124
export async function getAllPricesByNetworkTicker (networkTicker: string, attempt: number = 1): Promise<IResponseDataDaily[]> {

0 commit comments

Comments
 (0)