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