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() {
|
||||
setIsloading(true)
|
||||
const data = await getData()
|
||||
if (!data) setError(`Could not fetch data from ${statusApiUri}`)
|
||||
if (!data) setError(`Could not get data from ${statusApiUri}`)
|
||||
setData(data)
|
||||
setIsloading(false)
|
||||
}
|
||||
@ -76,7 +76,9 @@ export default function HomePage(): ReactElement {
|
||||
) : (
|
||||
Object.entries(data || {}).map(([networkName, value]) => (
|
||||
<Fragment key={networkName}>
|
||||
<h2 className={styles.networkName}>{networkName}</h2>
|
||||
<h2 className={styles.networkName}>
|
||||
{networkName == 'general' ? null : networkName}
|
||||
</h2>
|
||||
<div className={styles.grid}>
|
||||
{value.components.map((component) => (
|
||||
<div
|
||||
|
@ -8,12 +8,13 @@ export async function getData(): Promise<{ [key: string]: Status }> {
|
||||
if (!response?.data || response.status !== 200)
|
||||
throw Error('ERROR: no data recieved')
|
||||
|
||||
// transform data into object with network names as keys,
|
||||
// and make sure 'general' is always the first key
|
||||
const output = Object.fromEntries(
|
||||
// transform data into object with network names as keys
|
||||
let output = Object.fromEntries(
|
||||
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
|
||||
} catch (error) {
|
||||
console.error(error.message)
|
||||
|
Loading…
Reference in New Issue
Block a user