From 19f22025ad3a4469f87521dcb1e5d5b74857b070 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 9 Aug 2018 10:07:46 -0400 Subject: [PATCH] add error if no default account because of metamask --- templates/demo/app/components/ens.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/templates/demo/app/components/ens.js b/templates/demo/app/components/ens.js index 5b87e346..0167bfcd 100644 --- a/templates/demo/app/components/ens.js +++ b/templates/demo/app/components/ens.js @@ -25,8 +25,13 @@ class ENS extends React.Component { }; } - componentWillMount() { + componentDidMount() { EmbarkJS.onReady(() => { + if (!web3.eth.defaultAccount) { + this.setState({ + globalError: 'There is currently no default account. If Metamask is active, please sign in or deactivate it.' + }); + } this.setState({ addressRegister: web3.eth.defaultAccount, valueLookup: web3.eth.defaultAccount @@ -102,6 +107,7 @@ class ENS extends React.Component { render() { return ( + {this.state.globalError && {this.state.globalError}}

Resolve a name