Commit 4b71c2b4 authored by Yuri Mikhin's avatar Yuri Mikhin Committed by Yuri Mikhin

Add error state for chart on the address page.

parent cab95aa0
...@@ -7,6 +7,7 @@ import type { Address } from 'types/api/address'; ...@@ -7,6 +7,7 @@ import type { Address } from 'types/api/address';
import appConfig from 'configs/app/config'; import appConfig from 'configs/app/config';
import useApiQuery from 'lib/api/useApiQuery'; import useApiQuery from 'lib/api/useApiQuery';
import ChartWidget from 'ui/shared/chart/ChartWidget'; import ChartWidget from 'ui/shared/chart/ChartWidget';
import DataFetchAlert from 'ui/shared/DataFetchAlert';
interface Props { interface Props {
addressQuery: UseQueryResult<Address>; addressQuery: UseQueryResult<Address>;
...@@ -23,12 +24,16 @@ const AddressCoinBalanceChart = ({ addressQuery }: Props) => { ...@@ -23,12 +24,16 @@ const AddressCoinBalanceChart = ({ addressQuery }: Props) => {
value: BigNumber(value).div(10 ** appConfig.network.currency.decimals).toNumber(), value: BigNumber(value).div(10 ** appConfig.network.currency.decimals).toNumber(),
})), [ data ]); })), [ data ]);
if (isError) {
return <DataFetchAlert/>;
}
return ( return (
<ChartWidget <ChartWidget
chartHeight="200px" chartHeight="200px"
title="Balances" title="Balances"
items={ items } items={ items }
isLoading={ isLoading || isError } isLoading={ isLoading }
/> />
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment