mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-22 05:42:33 +03:00
lint
This commit is contained in:
parent
a20f3da34c
commit
82a123d05b
@ -4,7 +4,7 @@ const BASE_URL = 'https://api.coingecko.com';
|
||||
const PATH_API = 'api';
|
||||
const API_VERSION = 'v3';
|
||||
|
||||
//documentation reference: https://www.coingecko.com/en/api/documentation
|
||||
// documentation reference: https://www.coingecko.com/en/api/documentation
|
||||
|
||||
const coingeckoApi = axios.create({
|
||||
baseURL: `${BASE_URL}/${PATH_API}/${API_VERSION}`,
|
||||
|
@ -17,7 +17,6 @@ export const fetchMarketChart = async (
|
||||
days: number,
|
||||
interval?: ChartInterval,
|
||||
): Promise<MarketData> => {
|
||||
|
||||
try {
|
||||
const params = {
|
||||
vs_currency,
|
||||
@ -25,14 +24,13 @@ export const fetchMarketChart = async (
|
||||
interval,
|
||||
};
|
||||
|
||||
//failsafe for accidental invalid parameters
|
||||
//ref: https://www.coingecko.com/en/api/documentation
|
||||
//endpoint: /coins/{id}/market_chart
|
||||
if(days > 90 && interval === ChartInterval.HOURLY){
|
||||
interval = ChartInterval.DAILY
|
||||
// failsafe for accidental invalid parameters
|
||||
// ref: https://www.coingecko.com/en/api/documentation
|
||||
// endpoint: /coins/{id}/market_chart
|
||||
if (days > 90 && interval === ChartInterval.HOURLY) {
|
||||
interval = ChartInterval.DAILY;
|
||||
}
|
||||
|
||||
|
||||
const res = await coingeckoApi.get(`/${PATH_COINS}/${coingeckoId}/${PATH_MARKET_CHART}`, {
|
||||
params,
|
||||
});
|
||||
|
@ -21,7 +21,6 @@ export const CoinChart = ({ coinId, isEngine }: CoinChartProps) => {
|
||||
const [chartData, setChartData] = useState(priceHistory?.data);
|
||||
|
||||
const _fetchMarketData = async (days: number) => {
|
||||
|
||||
if (isEngine) {
|
||||
const marketData = await fetchEngineMarketData(
|
||||
coinId,
|
||||
@ -32,10 +31,11 @@ export const CoinChart = ({ coinId, isEngine }: CoinChartProps) => {
|
||||
setChartData(marketData.map((item) => item.close));
|
||||
} else {
|
||||
const marketData = await fetchMarketChart(
|
||||
coinId,
|
||||
currency.currency,
|
||||
days,
|
||||
days > 30 ? ChartInterval.DAILY : ChartInterval.HOURLY);
|
||||
coinId,
|
||||
currency.currency,
|
||||
days,
|
||||
days > 30 ? ChartInterval.DAILY : ChartInterval.HOURLY,
|
||||
);
|
||||
setChartData(marketData.prices.map((item) => item.yValue));
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user