@@ -21,6 +21,7 @@ class SimpleReactFileUpload extends Component {
2121 this . onStorageFormFileChange = this . onStorageFormFileChange . bind ( this ) ;
2222
2323 this . onACLFormSubmit = this . onACLFormSubmit . bind ( this ) ;
24+ this . onStatusFormSubmit = this . onStatusFormSubmit . bind ( this ) ;
2425
2526 this . onACLGrantRead = this . onACLGrantRead . bind ( this ) ;
2627 this . onACLGrantWrite = this . onACLGrantWrite . bind ( this ) ;
@@ -32,6 +33,7 @@ class SimpleReactFileUpload extends Component {
3233 this . onHasRead = this . onHasRead . bind ( this ) ;
3334 this . onHasAdmin = this . onHasAdmin . bind ( this ) ;
3435 this . onGetOwner = this . onGetOwner . bind ( this ) ;
36+ this . onGetStatus = this . onGetStatus . bind ( this ) ;
3537 }
3638
3739 componentDidMount ( ) {
@@ -74,6 +76,10 @@ class SimpleReactFileUpload extends Component {
7476 e . preventDefault ( ) ;
7577 }
7678
79+ onStatusFormSubmit ( e ) {
80+ e . preventDefault ( ) ;
81+ }
82+
7783 onACLGrantRead ( ) {
7884 const { web3, owner, account, acl } = this . state ;
7985
@@ -164,12 +170,24 @@ class SimpleReactFileUpload extends Component {
164170 . catch ( console . log )
165171 }
166172
173+ onGetStatus ( ) {
174+ const { peerId } = this . state ;
175+
176+ Leth . Storage . status ( web3 , this . gateway . storage )
177+ . then ( ( res ) => {
178+ console . log ( res ) ;
179+
180+ this . setState ( { peerId : res . peer_id } ) ;
181+ } )
182+ . catch ( console . log )
183+ }
184+
167185 onStorageFormFileChange ( e ) {
168186 this . setState ( { file : e . target . files [ 0 ] } )
169187 }
170188
171189 render ( ) {
172- const { owner, account, gatewayUrl, meta, acl, grantReadMsg } = this . state ;
190+ const { owner, account, gatewayUrl, meta, peerId , acl, grantReadMsg } = this . state ;
173191
174192 return (
175193 < div >
@@ -207,6 +225,14 @@ class SimpleReactFileUpload extends Component {
207225 < p >
208226 < strong > { grantReadMsg } </ strong >
209227 </ p >
228+
229+ < h3 > Status:</ h3 >
230+ < p > PeerId: { peerId } </ p >
231+ < p >
232+ < form onSubmit = { this . onStatusFormSubmit } >
233+ < button type = "submit" onClick = { this . onGetStatus } > What's the node's status?</ button >
234+ </ form >
235+ </ p >
210236 </ p >
211237 </ div >
212238 )
0 commit comments