mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-02 10:25:21 +00:00
display error message when there is a connection error
This commit is contained in:
parent
1065d3eae1
commit
65d3d5c1e9
@ -18,6 +18,7 @@ class App extends React.Component {
|
|||||||
this.handleSelect = this.handleSelect.bind(this);
|
this.handleSelect = this.handleSelect.bind(this);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
|
error: false,
|
||||||
activeKey: 1,
|
activeKey: 1,
|
||||||
whisperEnabled: false,
|
whisperEnabled: false,
|
||||||
storageEnabled: false,
|
storageEnabled: false,
|
||||||
@ -26,7 +27,12 @@ class App extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
EmbarkJS.onReady(() => {
|
EmbarkJS.onReady((err) => {
|
||||||
|
if (err) {
|
||||||
|
// If err is not null then it means something went wrong connecting to ethereum
|
||||||
|
// you can use this to ask the user to enable metamask for e.g
|
||||||
|
return this.setState({error: err});
|
||||||
|
}
|
||||||
if (EmbarkJS.isNewWeb3()) {
|
if (EmbarkJS.isNewWeb3()) {
|
||||||
EmbarkJS.Messages.Providers.whisper.getWhisperVersion((err, _version) => {
|
EmbarkJS.Messages.Providers.whisper.getWhisperVersion((err, _version) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -70,7 +76,14 @@ class App extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (<div><h3>Embark - Usage Example</h3>
|
if (this.state.error) {
|
||||||
|
return (<div>
|
||||||
|
<div>Something went wrong connecting to ethereum. Please make sure you have a node running or are using metamask to connect to the ethereum network:</div>
|
||||||
|
<div>{this.state.error}</div>
|
||||||
|
</div>);
|
||||||
|
} else {
|
||||||
|
return (<div>
|
||||||
|
<h3>Embark - Usage Example</h3>
|
||||||
<Tabs onSelect={this.handleSelect} activeKey={this.state.activeKey} id="uncontrolled-tab-example">
|
<Tabs onSelect={this.handleSelect} activeKey={this.state.activeKey} id="uncontrolled-tab-example">
|
||||||
<Tab eventKey={1} title="Blockchain">
|
<Tab eventKey={1} title="Blockchain">
|
||||||
<Blockchain/>
|
<Blockchain/>
|
||||||
@ -86,6 +99,7 @@ class App extends React.Component {
|
|||||||
</Tab>
|
</Tab>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>);
|
</div>);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user