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:
parent
cde444ba8f
commit
46d7fa2ea1
@ -1,11 +1,13 @@
|
|||||||
import React, { useEffect, useState, ReactElement } from 'react'
|
import React, { useEffect, useState, ReactElement } from 'react'
|
||||||
import Loader from '../../atoms/Loader'
|
import Loader from '../../atoms/Loader'
|
||||||
import { useOcean } from '@oceanprotocol/react'
|
import { useOcean } from '@oceanprotocol/react'
|
||||||
|
import { Logger } from '@oceanprotocol/lib'
|
||||||
import { QueryResult } from '@oceanprotocol/lib/dist/node/metadatastore/MetadataStore'
|
import { QueryResult } from '@oceanprotocol/lib/dist/node/metadatastore/MetadataStore'
|
||||||
import AssetList from '../../organisms/AssetList'
|
import AssetList from '../../organisms/AssetList'
|
||||||
|
|
||||||
export default function PublishedList(): ReactElement {
|
export default function PublishedList(): ReactElement {
|
||||||
const { ocean, status, accountId } = useOcean()
|
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 [queryResult, setQueryResult] = useState<QueryResult>()
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
|
|
||||||
@ -13,13 +15,15 @@ export default function PublishedList(): ReactElement {
|
|||||||
async function getPublished() {
|
async function getPublished() {
|
||||||
if (!accountId || !ocean) return
|
if (!accountId || !ocean) return
|
||||||
|
|
||||||
setIsLoading(true)
|
try {
|
||||||
|
setIsLoading(true)
|
||||||
// const queryResult = await
|
const queryResult = await ocean.assets.ownerAssets(accountId)
|
||||||
|
setQueryResult(queryResult)
|
||||||
setQueryResult(queryResult)
|
} catch (error) {
|
||||||
|
Logger.error(error.message)
|
||||||
setIsLoading(false)
|
} finally {
|
||||||
|
setIsLoading(false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
getPublished()
|
getPublished()
|
||||||
}, [ocean, status, accountId])
|
}, [ocean, status, accountId])
|
||||||
|
Loading…
Reference in New Issue
Block a user