mirror of
https://github.com/oceanprotocol/react.git
synced 2025-02-14 21:10:38 +01:00
fix undefined in getComputeItems
This commit is contained in:
parent
cda25a7271
commit
da2fa1a417
@ -13,7 +13,7 @@ interface UseSearch {
|
|||||||
searchWithQuery: (query: SearchQuery) => Promise<QueryResult>
|
searchWithQuery: (query: SearchQuery) => Promise<QueryResult>
|
||||||
getPublishedList: (page: number, offset: number) => Promise<QueryResult>
|
getPublishedList: (page: number, offset: number) => Promise<QueryResult>
|
||||||
getConsumedList: () => Promise<DDO[] | undefined>
|
getConsumedList: () => Promise<DDO[] | undefined>
|
||||||
getComputeItems: () => Promise<ComputeItem[]>
|
getComputeItems: () => Promise<ComputeItem[] | undefined>
|
||||||
searchError?: string
|
searchError?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,13 +75,16 @@ function useSearch(): UseSearch {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
const filteredConsumedItems = consumedItems.filter(
|
||||||
return consumedItems
|
(value) => typeof value !== 'undefined'
|
||||||
|
)
|
||||||
|
return filteredConsumedItems
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getComputeItems(): Promise<ComputeItem[]> {
|
async function getComputeItems(): Promise<ComputeItem[] | undefined> {
|
||||||
|
if (!ocean || !account) return
|
||||||
const jobList = await ocean.compute.status(account)
|
const jobList = await ocean.compute.status(account)
|
||||||
return Promise.all(
|
const computeItems = await Promise.all(
|
||||||
jobList.map(async (job) => {
|
jobList.map(async (job) => {
|
||||||
if (!job) return
|
if (!job) return
|
||||||
const { did } = await ocean.keeper.agreementStoreManager.getAgreement(
|
const { did } = await ocean.keeper.agreementStoreManager.getAgreement(
|
||||||
@ -101,6 +104,10 @@ function useSearch(): UseSearch {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
const filteredComputeItems = computeItems.filter(
|
||||||
|
(value) => typeof value.ddo !== 'undefined'
|
||||||
|
)
|
||||||
|
return filteredComputeItems
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user