mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
Copy-edited react-publish-data-set.md
This commit is contained in:
parent
a86f2473e2
commit
cd135ac557
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: Publish a Data Set
|
title: Publish a Data Set
|
||||||
description: Tutorial to add data set publishing capabilities to a basic React app.
|
description: Tutorial to add dataset publishing capabilities to a basic React app.
|
||||||
---
|
---
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
@ -10,7 +10,7 @@ This is a continuation of the [React App Setup](/tutorials/react-setup) tutorial
|
|||||||
## Adding Publishing
|
## Adding Publishing
|
||||||
|
|
||||||
1. Open `src/App.js` in your marketplace app from the [React App Setup](/tutorials/react-setup) tutorial.
|
1. Open `src/App.js` in your marketplace app from the [React App Setup](/tutorials/react-setup) tutorial.
|
||||||
2. First let's add the asset that we want to publish. To do that we need to add the following code after `window.ethereum.enable()` line.
|
2. First let's add the asset that we want to publish. To do that, we need to add the following code after `window.ethereum.enable()` line.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const asset = {
|
const asset = {
|
||||||
@ -50,7 +50,7 @@ This is a continuation of the [React App Setup](/tutorials/react-setup) tutorial
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Now that we have asset to submit we need function to handle it. Just before `render() {` let's add:
|
3. Now that we have an asset to submit, we need function to handle it. Just before `render() {` let's add:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
async submitAsset(){
|
async submitAsset(){
|
||||||
@ -60,7 +60,7 @@ This is a continuation of the [React App Setup](/tutorials/react-setup) tutorial
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Last thing we need is button to start our registration inside render function just after `<h1>Marketplace app</h1>`
|
4. The last thing we need is a button to start our registration inside the render function just after `<h1>Marketplace app</h1>`:
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
<button onClick={() => this.submitAsset()}>Register asset</button>
|
<button onClick={() => this.submitAsset()}>Register asset</button>
|
||||||
@ -68,9 +68,9 @@ This is a continuation of the [React App Setup](/tutorials/react-setup) tutorial
|
|||||||
|
|
||||||
## Finished
|
## Finished
|
||||||
|
|
||||||
That's it, if you have no errors in your `console.log` and you receive alert after you click `Register asset` you have successfully registered an asset.
|
That's it. If you have no errors in your `console.log` and you receive an alert after you click `Register asset` then you have successfully registered an asset.
|
||||||
|
|
||||||
Here is full source of `src/App.js` that you should have if you followed this tutorial:
|
Here is the full source of `src/App.js` that you should have if you followed this tutorial:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user