diff --git a/templates/demo/app/dapp.js b/templates/demo/app/dapp.js index 77a837fb..50b305e3 100644 --- a/templates/demo/app/dapp.js +++ b/templates/demo/app/dapp.js @@ -18,6 +18,7 @@ class App extends React.Component { this.handleSelect = this.handleSelect.bind(this); this.state = { + error: false, activeKey: 1, whisperEnabled: false, storageEnabled: false, @@ -26,7 +27,12 @@ class App extends React.Component { } 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()) { EmbarkJS.Messages.Providers.whisper.getWhisperVersion((err, _version) => { if (err) { @@ -70,7 +76,14 @@ class App extends React.Component { } render() { - return (