1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

fix disable compute button if algo is consumable

This commit is contained in:
Bogdan Fazakas 2022-06-23 17:18:54 +03:00
parent 98beb1c3af
commit e9ff4f7717

View File

@ -83,6 +83,8 @@ export default function Compute({
const [validAlgorithmOrderTx, setValidAlgorithmOrderTx] = useState('')
const [isConsumablePrice, setIsConsumablePrice] = useState(true)
const [isConsumableaAlgorithmPrice, setIsConsumableAlgorithmPrice] =
useState(true)
const [computeStatusText, setComputeStatusText] = useState('')
const [computeEnv, setComputeEnv] = useState<ComputeEnvironment>()
const [initializedProviderResponse, setInitializedProviderResponse] =
@ -102,7 +104,9 @@ export default function Compute({
isOrdering === true ||
file === null ||
(!validOrderTx && !hasDatatoken && !isConsumablePrice) ||
(!validAlgorithmOrderTx && !hasAlgoAssetDatatoken)
(!validAlgorithmOrderTx &&
!hasAlgoAssetDatatoken &&
!isConsumableaAlgorithmPrice)
async function checkAssetDTBalance(asset: DDO): Promise<boolean> {
if (!asset?.services[0].datatokenAddress) return
@ -254,7 +258,9 @@ export default function Compute({
if (!selectedAlgorithmAsset?.accessDetails || !accountId) return
setIsRequestingAlgoOrderPrice(true)
setIsConsumablePrice(selectedAlgorithmAsset?.accessDetails?.isPurchasable)
setIsConsumableAlgorithmPrice(
selectedAlgorithmAsset?.accessDetails?.isPurchasable
)
setValidAlgorithmOrderTx(
selectedAlgorithmAsset?.accessDetails?.validOrderTx
)