mirror of
https://github.com/oceanprotocol/react.git
synced 2024-12-23 01:29:49 +01:00
fix handlers
This commit is contained in:
parent
1b5c5caad9
commit
d2e5a8114d
@ -47,7 +47,7 @@ export function Publish() {
|
|||||||
setDdo(ddo)
|
setDdo(ddo)
|
||||||
}
|
}
|
||||||
|
|
||||||
const PostForSale = async () => {
|
const handlePostForSale = async () => {
|
||||||
if(ddo){
|
if(ddo){
|
||||||
const priceOptions = {
|
const priceOptions = {
|
||||||
price: 7,
|
price: 7,
|
||||||
@ -74,7 +74,7 @@ export function Publish() {
|
|||||||
</div>
|
</div>
|
||||||
<div>DID: {ddo && ddo.id} </div>
|
<div>DID: {ddo && ddo.id} </div>
|
||||||
<div>
|
<div>
|
||||||
<button onClick={PostForSale}>Post for sale</button>
|
<button onClick={handlePostForSale}>Post for sale</button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
IsLoading: {pricingIsLoading.toString()} || pricingStatus: {pricingStepText}
|
IsLoading: {pricingIsLoading.toString()} || pricingStatus: {pricingStepText}
|
||||||
|
@ -9,7 +9,7 @@ export function Trade() {
|
|||||||
const { ocean, accountId } = useOcean()
|
const { ocean, accountId } = useOcean()
|
||||||
const { createPricing, buyDT, sellDT, pricingStep, pricingStepText, isLoading: pricingIsLoading, pricingError} = usePricing()
|
const { createPricing, buyDT, sellDT, pricingStep, pricingStepText, isLoading: pricingIsLoading, pricingError} = usePricing()
|
||||||
const [did, setDid] = useState<string | undefined>()
|
const [did, setDid] = useState<string | undefined>()
|
||||||
const ActionBuy = async () => {
|
const handleBuy = async () => {
|
||||||
if (!did) { console.error("No DID"); return}
|
if (!did) { console.error("No DID"); return}
|
||||||
const ddo = await ocean.assets.resolve(did)
|
const ddo = await ocean.assets.resolve(did)
|
||||||
if(ddo){
|
if(ddo){
|
||||||
@ -20,7 +20,7 @@ export function Trade() {
|
|||||||
console.error("Publish the asset first and create a pricing")
|
console.error("Publish the asset first and create a pricing")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const ActionSell = async () => {
|
const handleSell = async () => {
|
||||||
if (!did) { console.error("No DID"); return}
|
if (!did) { console.error("No DID"); return}
|
||||||
const ddo = await ocean.assets.resolve(did)
|
const ddo = await ocean.assets.resolve(did)
|
||||||
if(ddo){
|
if(ddo){
|
||||||
@ -41,10 +41,10 @@ export function Trade() {
|
|||||||
DID <input onChange={handleChange}></input>
|
DID <input onChange={handleChange}></input>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button onClick={ActionBuy}>Buy 1 DT</button>
|
<button onClick={handleBuy}>Buy 1 DT</button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button onClick={ActionSell}>Sell 1 DT</button>
|
<button onClick={handleSell}>Sell 1 DT</button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
IsLoading: {pricingIsLoading.toString()} || Status: {pricingStepText}
|
IsLoading: {pricingIsLoading.toString()} || Status: {pricingStepText}
|
||||||
|
Loading…
Reference in New Issue
Block a user