mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
fix run order
This commit is contained in:
parent
8d8336d169
commit
c8ab797e02
@ -29,7 +29,7 @@ export default function Price({
|
|||||||
async function init() {
|
async function init() {
|
||||||
const price = await getBestPrice(ddo.dataToken)
|
const price = await getBestPrice(ddo.dataToken)
|
||||||
setPrice(price)
|
setPrice(price)
|
||||||
setPriceOutside && setPriceOutside(price)
|
setPriceOutside && price !== '' && setPriceOutside(price)
|
||||||
}
|
}
|
||||||
init()
|
init()
|
||||||
}, [chainId])
|
}, [chainId])
|
||||||
|
@ -33,22 +33,23 @@ export default function Compute({ ddo }: { ddo: DDO }): ReactElement {
|
|||||||
const [algorithmRawCode, setAlgorithmRawCode] = useState('')
|
const [algorithmRawCode, setAlgorithmRawCode] = useState('')
|
||||||
const [isPublished, setIsPublished] = useState(false)
|
const [isPublished, setIsPublished] = useState(false)
|
||||||
const [file, setFile] = useState(null)
|
const [file, setFile] = useState(null)
|
||||||
const [isTermsAgreed, setIsTermsAgreed] = useState(true)
|
|
||||||
const [price, setPrice] = useState<string>()
|
const [price, setPrice] = useState<string>()
|
||||||
|
|
||||||
const isFree = price === '0'
|
|
||||||
|
|
||||||
const isComputeButtonDisabled =
|
const isComputeButtonDisabled =
|
||||||
isJobStarting ||
|
isJobStarting ||
|
||||||
file === null ||
|
file === null ||
|
||||||
computeType === '' ||
|
computeType === '' ||
|
||||||
!ocean ||
|
!ocean ||
|
||||||
!isBalanceSufficient ||
|
!isBalanceSufficient
|
||||||
!isTermsAgreed
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!price || !balance || !balance.ocean) return
|
if (!price || !balance || !balance.ocean) return
|
||||||
setIsBalanceSufficient(compareAsBN(balance.ocean, price, Comparison.gte))
|
|
||||||
|
const isFree = price === '0'
|
||||||
|
|
||||||
|
setIsBalanceSufficient(
|
||||||
|
isFree ? true : compareAsBN(balance.ocean, price, Comparison.gte)
|
||||||
|
)
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
setIsBalanceSufficient(false)
|
setIsBalanceSufficient(false)
|
||||||
@ -123,7 +124,6 @@ export default function Compute({ ddo }: { ddo: DDO }): ReactElement {
|
|||||||
Start job
|
Start job
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
{/* <TermsCheckbox onChange={onCheck} /> */}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer className={styles.feedback}>
|
<footer className={styles.feedback}>
|
||||||
|
@ -22,13 +22,15 @@ export default function Consume({
|
|||||||
const [price, setPrice] = useState<string>()
|
const [price, setPrice] = useState<string>()
|
||||||
const [isBalanceSufficient, setIsBalanceSufficient] = useState(false)
|
const [isBalanceSufficient, setIsBalanceSufficient] = useState(false)
|
||||||
|
|
||||||
const isFree = price === '0'
|
|
||||||
const isDisabled = !ocean || !isBalanceSufficient
|
const isDisabled = !ocean || !isBalanceSufficient
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!price || !balance || !balance.ocean) return
|
if (!price || !balance || !balance.ocean) return
|
||||||
|
|
||||||
setIsBalanceSufficient(compareAsBN(balance.ocean, price, Comparison.gte))
|
const isFree = price === '0'
|
||||||
|
setIsBalanceSufficient(
|
||||||
|
isFree ? true : compareAsBN(balance.ocean, price, Comparison.gte)
|
||||||
|
)
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
setIsBalanceSufficient(false)
|
setIsBalanceSufficient(false)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user