diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 56d5de1..d9639f0 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -31,12 +31,8 @@ export default function HomePage(): ReactElement { useEffect(() => { async function getStatuses() { const statusData = await getData() - console.log('statusData', statusData) if (statusData) setStatuses(statusData) - console.log('statuses', statuses) - - const summaryData = getSummary(network, statuses) - console.log('summaryData', summaryData) + const summaryData = getSummary(network, statusData) if (summaryData) setSummary(summaryData) } getStatuses() diff --git a/src/utils/getData.ts b/src/utils/getData.ts index fe00e5a..f365155 100644 --- a/src/utils/getData.ts +++ b/src/utils/getData.ts @@ -9,7 +9,7 @@ export async function getData(): Promise { if (!response || response.status !== 200 || !response.data) console.log('ERROR: no data recieved') - const data = [...response.data] + const data = response.data console.log('1. data length', data.length) console.log('1. data ', data) @@ -20,33 +20,34 @@ export async function getData(): Promise { } export function getSummary(network: string, data: Status[]): Summary[] { - console.log('2. data', data) + console.log('2. data', network, data) try { if (data) { let status: Status data.forEach((element) => { if (element.network === network) return (status = element) }) + console.log('network status: ', status) const summary: Summary[] = [ - { component: 'Aquarius', status: status.aquarius.status }, - { component: 'Provider', status: status.provider.status }, - { component: 'Subgraph', status: status.subgraph.status }, - { component: 'Market', status: status.market }, - { component: 'Port', status: status.port }, + { component: 'Aquarius', status: status?.aquarius?.status }, + { component: 'Provider', status: status?.provider?.status }, + { component: 'Subgraph', status: status?.subgraph?.status }, + { component: 'Market', status: status?.market }, + { component: 'Port', status: status?.port }, { component: 'Data Farming', - status: status.dataFarming + status: status?.dataFarming }, { component: 'Operator Service', - status: status.operator.status + status: status?.operator?.status }, { component: 'DAO Grants', - status: status.daoGrants + status: status?.daoGrants } ] - status.faucet.status && + status?.faucet?.status && summary.push({ component: 'Faucet', status: status.faucet.status