add error message if metamask wasnot found

This commit is contained in:
Roman Storm 2017-12-12 00:29:28 -08:00
parent b3b5c37312
commit edc3130759
3 changed files with 16 additions and 8 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
node_modules/
.DS_Store
.DS_Store
build/

View File

@ -1,8 +1,8 @@
{
"name": "finalapp",
"name": "oracles-dapps-validators",
"version": "0.1.0",
"private": true,
"homepage": "https://rstormsf.github.io/oracles-dapps-keys-generation",
"homepage": "https://rstormsf.github.io/oracles-dapps-validators",
"dependencies": {
"clipboard": "^1.7.1",
"gh-pages": "^1.1.0",

View File

@ -1,5 +1,6 @@
import React, {Component} from 'react';
import ReactDOM from 'react-dom';
import swal from 'sweetalert';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
import KeysManager from './contracts/KeysManager.contract'
@ -18,10 +19,6 @@ import AllValidators from './AllValidators'
const history = createBrowserHistory()
class AppMainRouter extends Component {
constructor(props){
super(props);
@ -36,6 +33,7 @@ class AppMainRouter extends Component {
metadataContract: null,
poaConsensus: null,
votingKey :null,
loading: true,
}
getWeb3().then(async (web3Config) => {
const keysManager = new KeysManager({
@ -48,7 +46,16 @@ class AppMainRouter extends Component {
votingKey: web3Config.defaultAccount,
keysManager,
metadataContract,
loading: false,
})
}).catch((error) => {
console.error(error.msg);
this.setState({loading: false})
swal({
icon: 'error',
title: 'Error',
content: error.node
});
})
}
onRouteChange(){
@ -74,7 +81,7 @@ class AppMainRouter extends Component {
}
render(){
const search = this.state.showSearch ? <input type="text" className="search-input"/> : ''
const loading = this.state.votingKey ? '' : <Loading />
const loading = this.state.loading ? <Loading /> : ''
return (
<Router history={history}>
<section className="content">