add error if no default account because of metamask

This commit is contained in:
Jonathan Rainville 2018-08-09 10:07:46 -04:00 committed by Iuri Matias
parent f0f9840757
commit 19f22025ad
1 changed files with 7 additions and 1 deletions

View File

@ -25,8 +25,13 @@ class ENS extends React.Component {
}; };
} }
componentWillMount() { componentDidMount() {
EmbarkJS.onReady(() => { 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({ this.setState({
addressRegister: web3.eth.defaultAccount, addressRegister: web3.eth.defaultAccount,
valueLookup: web3.eth.defaultAccount valueLookup: web3.eth.defaultAccount
@ -102,6 +107,7 @@ class ENS extends React.Component {
render() { render() {
return (<React.Fragment> return (<React.Fragment>
{this.state.globalError && <Alert bsStyle="danger">{this.state.globalError}</Alert>}
<h3>Resolve a name</h3> <h3>Resolve a name</h3>
<Form inline> <Form inline>
<FormGroup> <FormGroup>