mirror of
https://github.com/oceanprotocol/status-frontend.git
synced 2024-11-21 17:36:58 +01:00
tweak data ordering
This commit is contained in:
parent
99320cffe4
commit
a9d6a68545
@ -37,7 +37,7 @@ export default function HomePage(): ReactElement {
|
|||||||
async function getStatuses() {
|
async function getStatuses() {
|
||||||
setIsloading(true)
|
setIsloading(true)
|
||||||
const data = await getData()
|
const data = await getData()
|
||||||
if (!data) setError(`Could not fetch data from ${statusApiUri}`)
|
if (!data) setError(`Could not get data from ${statusApiUri}`)
|
||||||
setData(data)
|
setData(data)
|
||||||
setIsloading(false)
|
setIsloading(false)
|
||||||
}
|
}
|
||||||
@ -76,7 +76,9 @@ export default function HomePage(): ReactElement {
|
|||||||
) : (
|
) : (
|
||||||
Object.entries(data || {}).map(([networkName, value]) => (
|
Object.entries(data || {}).map(([networkName, value]) => (
|
||||||
<Fragment key={networkName}>
|
<Fragment key={networkName}>
|
||||||
<h2 className={styles.networkName}>{networkName}</h2>
|
<h2 className={styles.networkName}>
|
||||||
|
{networkName == 'general' ? null : networkName}
|
||||||
|
</h2>
|
||||||
<div className={styles.grid}>
|
<div className={styles.grid}>
|
||||||
{value.components.map((component) => (
|
{value.components.map((component) => (
|
||||||
<div
|
<div
|
||||||
|
@ -8,12 +8,13 @@ export async function getData(): Promise<{ [key: string]: Status }> {
|
|||||||
if (!response?.data || response.status !== 200)
|
if (!response?.data || response.status !== 200)
|
||||||
throw Error('ERROR: no data recieved')
|
throw Error('ERROR: no data recieved')
|
||||||
|
|
||||||
// transform data into object with network names as keys,
|
// transform data into object with network names as keys
|
||||||
// and make sure 'general' is always the first key
|
let output = Object.fromEntries(
|
||||||
const output = Object.fromEntries(
|
|
||||||
response.data?.map((item) => [item.network, item])
|
response.data?.map((item) => [item.network, item])
|
||||||
)
|
)
|
||||||
console.log('Got new data', output)
|
// make sure 'general' is always the first key
|
||||||
|
output = Object.assign({ general: output['general'] }, output)
|
||||||
|
console.log('Got new data', JSON.stringify(output))
|
||||||
return output
|
return output
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error.message)
|
console.error(error.message)
|
||||||
|
Loading…
Reference in New Issue
Block a user