1
0
mirror of https://github.com/oceanprotocol/react.git synced 2024-11-23 02:00:27 +01:00
This commit is contained in:
mihaisc 2020-05-20 14:19:21 +03:00
parent aa63e7cdf6
commit bca68929e2

View File

@ -7,14 +7,11 @@ import {
QueryResult
} from '@oceanprotocol/squid/dist/node/aquarius/Aquarius'
// TODO searchText,
// TODO searchText,
interface UseSearch {
searchWithQuery: (query: SearchQuery) => Promise<QueryResult>
getPublishedList: (
page: number,
offset: number
) => Promise<QueryResult>
getConsumedList: () => Promise<(DDO[] | undefined)>
getPublishedList: (page: number, offset: number) => Promise<QueryResult>
getConsumedList: () => Promise<DDO[] | undefined>
searchError?: string
}
@ -62,7 +59,7 @@ function useSearch(): UseSearch {
}
}
async function getConsumedList() : Promise<(DDO []| undefined)>{
async function getConsumedList(): Promise<DDO[] | undefined> {
const consumed = await ocean.assets.consumerAssets(accountId)
const consumedItems = await Promise.all(
consumed.map(async (did) => {
@ -76,11 +73,11 @@ function useSearch(): UseSearch {
}
})
)
return consumedItems
}
return { searchWithQuery, getPublishedList,getConsumedList, searchError }
return { searchWithQuery, getPublishedList, getConsumedList, searchError }
}
export { useSearch, UseSearch }