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])