From 46d7fa2ea11f30ca61ad1ea1df732595aafde243 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 22 Sep 2020 12:04:57 +0000 Subject: [PATCH] populate PublishedList * blocked by https://github.com/oceanprotocol/ocean-lib-js/pull/308 --- src/components/pages/History/PublishedList.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/pages/History/PublishedList.tsx b/src/components/pages/History/PublishedList.tsx index a2e2cc7d7..27b7e46e6 100644 --- a/src/components/pages/History/PublishedList.tsx +++ b/src/components/pages/History/PublishedList.tsx @@ -1,11 +1,13 @@ import React, { useEffect, useState, ReactElement } from 'react' import Loader from '../../atoms/Loader' import { useOcean } from '@oceanprotocol/react' +import { Logger } from '@oceanprotocol/lib' import { QueryResult } from '@oceanprotocol/lib/dist/node/metadatastore/MetadataStore' import AssetList from '../../organisms/AssetList' export default function PublishedList(): ReactElement { const { ocean, status, accountId } = useOcean() + // TODO: wait for ocean-lib-js with https://github.com/oceanprotocol/ocean-lib-js/pull/308 const [queryResult, setQueryResult] = useState() const [isLoading, setIsLoading] = useState(false) @@ -13,13 +15,15 @@ export default function PublishedList(): ReactElement { async function getPublished() { if (!accountId || !ocean) return - setIsLoading(true) - - // const queryResult = await - - setQueryResult(queryResult) - - setIsLoading(false) + try { + setIsLoading(true) + const queryResult = await ocean.assets.ownerAssets(accountId) + setQueryResult(queryResult) + } catch (error) { + Logger.error(error.message) + } finally { + setIsLoading(false) + } } getPublished() }, [ocean, status, accountId])