(null);
useEffect(() => {
- getDataSource();
-
async function getStats() {
try {
const [res1, res2] = await Promise.all([
- fetch(dataSource.current.stats),
- fetch(dataSource.current.nodes),
+ fetch(statsEndpoint),
+ fetch(nodesEndpoint),
]);
const [{ statistics }, { nodeData }] = await Promise.all([
res1.json(),
@@ -134,7 +77,7 @@ export const StatsManager = ({ className }: statsManagerProps) => {
return () => {
clearInterval(interval);
};
- }, []);
+ }, [nodesEndpoint, statsEndpoint]);
const classes = classnames(
className,
@@ -144,8 +87,7 @@ export const StatsManager = ({ className }: statsManagerProps) => {
return (
- {(error && `/ ${error}`) ||
- (data ? `/ ${dataSource.current.title}` : '/ Connecting...')}
+ {(error && `/ ${error}`) || (data ? `/ ${envName}` : '/ Connecting...')}
{data?.promoted ? (