From 3110514c1625f2ff5d375008f8d1429871f15e53 Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Thu, 6 Oct 2022 17:43:52 +0300 Subject: [PATCH] updating request to new status API, adding key to componenets in map --- app.config.js | 2 +- src/pages/index.tsx | 5 ++++- src/utils/getData.ts | 16 +++++++--------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app.config.js b/app.config.js index 1121b87..30d0c7d 100644 --- a/app.config.js +++ b/app.config.js @@ -1,3 +1,3 @@ module.exports = { - statusServiceUri: process.env.NEXT_STATUS_API_URI || 'http://localhost:8080' + statusApiUri: process.env.NEXT_STATUS_API_URI || 'http://localhost:8000' } diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 16abb83..c48329d 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -46,7 +46,10 @@ export default function HomePage(): ReactElement { {data && ( <> {data.map((value: Summary) => ( -
+

{value?.component}

{value?.status}

diff --git a/src/utils/getData.ts b/src/utils/getData.ts index 1c1371f..79b05bf 100644 --- a/src/utils/getData.ts +++ b/src/utils/getData.ts @@ -1,12 +1,10 @@ import axios, { AxiosResponse } from 'axios' import { Status, Summary } from '../@types' -import { statusServiceUri } from '../../app.config' +import { statusApiUri } from '../../app.config' export async function getData(): Promise { try { - const response: AxiosResponse = await axios.get( - `${statusServiceUri}` - ) + const response: AxiosResponse = await axios.get(`${statusApiUri}`) if (!response || response.status !== 200 || !response.data) console.log('ERROR: no data recieved') @@ -43,14 +41,14 @@ export async function getSummary(network: number): Promise { status: data[network].daoGrants } ] + data[network].faucet.status && + summary.push({ + component: 'Faucet', + status: data[network].faucet.status + }) return summary } catch (error) { console.log(error) } } - -// data[network].faucet.status && { -// component: 'Faucet', -// status: data[network].faucet.status -// }