From 8d4c5ca58501bd87486586391463c1371fd74b3b Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 1 Jul 2020 17:25:43 +0200 Subject: [PATCH] output existing assets list on frontpage for debugging --- src/components/pages/Explore.tsx | 19 ----------------- src/components/pages/Home.tsx | 33 +++++++++++++++++++++++++++-- src/components/templates/Search.tsx | 2 +- 3 files changed, 32 insertions(+), 22 deletions(-) delete mode 100644 src/components/pages/Explore.tsx diff --git a/src/components/pages/Explore.tsx b/src/components/pages/Explore.tsx deleted file mode 100644 index 10f5ca7f5..000000000 --- a/src/components/pages/Explore.tsx +++ /dev/null @@ -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 = ({ - queryResult -}: ExplorePageProps) => ( - - - -) - -export default ExplorePage diff --git a/src/components/pages/Home.tsx b/src/components/pages/Home.tsx index a88253fa9..dcf7f4979 100644 --- a/src/components/pages/Home.tsx +++ b/src/components/pages/Home.tsx @@ -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 + const [assets, setAssets] = useState() + + useEffect(() => { + async function init() { + const result = await axios(`${config.aquariusUri}/api/v1/aquarius/assets`) + const assets = result.data.ids + setAssets(assets) + } + init() + }, []) + + return ( + <> + + {assets && ( +
    + {assets.map((did: DID) => ( +
  • + {did} +
  • + ))} +
+ )} + + ) } diff --git a/src/components/templates/Search.tsx b/src/components/templates/Search.tsx index 3e148bed0..7ed7b8ff0 100644 --- a/src/components/templates/Search.tsx +++ b/src/components/templates/Search.tsx @@ -65,7 +65,7 @@ export async function getResults(params: any): Promise { ]) : 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) )