New fetchWithValidation / introducing simpleFetch

This commit is contained in:
Aleksandr Kraiz
2022-05-10 11:44:09 +04:00
parent edc91ecefe
commit 883bcf928f
16 changed files with 350 additions and 117 deletions

View File

@@ -1,4 +1,4 @@
import { fetchJsonWithValidation } from '../../fetchWithValidation';
import fetchWithValidation from '../../fetchWithValidation';
import candlesSchema from './schemas/candlesSchema';
class PriceFeed {
@@ -6,6 +6,8 @@ class PriceFeed {
constructor(apiUrl: string) {
this.apiUrl = apiUrl;
this.getCandles = this.getCandles.bind(this);
}
getCandles(
@@ -22,7 +24,7 @@ class PriceFeed {
url.searchParams.append('interval', interval);
url.searchParams.append('exchange', exchange);
return fetchJsonWithValidation(
return fetchWithValidation(
url.toString(),
candlesSchema,
);