Skip to content

Commit

Permalink
populate PublishedList
Browse files Browse the repository at this point in the history
  • Loading branch information
kremalicious committed Sep 29, 2020
1 parent cde444b commit 46d7fa2
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/components/pages/History/PublishedList.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
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)

useEffect(() => {
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])
Expand Down

0 comments on commit 46d7fa2

Please sign in to comment.