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

populate PublishedList

* blocked by https://github.com/oceanprotocol/ocean-lib-js/pull/308
This commit is contained in:
Matthias Kretschmann 2020-09-22 12:04:57 +00:00
parent cde444ba8f
commit 46d7fa2ea1
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -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<QueryResult>()
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])