1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 01:34:57 +01:00

output existing assets list on frontpage for debugging

This commit is contained in:
Matthias Kretschmann 2020-07-01 17:25:43 +02:00
parent af62e9f5d4
commit 8d4c5ca585
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 32 additions and 22 deletions

View File

@ -1,19 +0,0 @@
import React from 'react'
import Layout from '../../components/Layout'
import AssetList from '../organisms/AssetList'
import { QueryResult } from '@oceanprotocol/squid/dist/node/aquarius/Aquarius'
export declare type ExplorePageProps = {
queryResult: QueryResult
}
const title = 'Explore Data'
const ExplorePage: React.FC<ExplorePageProps> = ({
queryResult
}: ExplorePageProps) => (
<Layout title={title} description="Find the data sets you are looking for.">
<AssetList queryResult={queryResult} />
</Layout>
)
export default ExplorePage

View File

@ -1,6 +1,35 @@
import React, { ReactElement } from 'react'
import React, { ReactElement, useState, useEffect } from 'react'
import SearchBar from '../molecules/SearchBar'
import { DID } from '@oceanprotocol/squid'
import { Link } from 'gatsby'
import shortid from 'shortid'
import axios from 'axios'
import { config } from '../../config/ocean'
export default function HomePage(): ReactElement {
return <SearchBar large />
const [assets, setAssets] = useState<DID[]>()
useEffect(() => {
async function init() {
const result = await axios(`${config.aquariusUri}/api/v1/aquarius/assets`)
const assets = result.data.ids
setAssets(assets)
}
init()
}, [])
return (
<>
<SearchBar large />
{assets && (
<ul>
{assets.map((did: DID) => (
<li key={shortid.generate()}>
<Link to={`/asset/${did}`}>{did}</Link>
</li>
))}
</ul>
)}
</>
)
}

View File

@ -65,7 +65,7 @@ export async function getResults(params: any): Promise<QueryResult> {
])
: undefined
const aquarius = new Aquarius(config.aquariusUri as string, Logger)
const aquarius = new Aquarius(config.aquariusUri, Logger)
const queryResult = await aquarius.queryMetadata(
getSearchQuery(page, offset, text, tag, priceQuery)
)