diff --git a/src/constants.js b/src/constants.js
index 42db88c..b4c6795 100644
--- a/src/constants.js
+++ b/src/constants.js
@@ -10,6 +10,12 @@ constants.AFFECTED_KEY_IS_NOT_ADDRESS_MSG = `Ballot affectedKey isn't address`;
constants.MINING_KEY_IS_NOT_ADDRESS_MSG = `Ballot miningKey isn't address`;
constants.PROPOSED_ADDRESS_IS_NOT_ADDRESS_MSG = `Ballot proposedAddress isn't address`;
constants.END_TIME_SHOULD_BE_GREATER_THAN_NOW_MSG = "Ballot end time should be greater than now";
+constants.NO_METAMASK_MSG = `You haven't chosen any account in MetaMask.
+Please, choose your voting key in MetaMask and reload the page.
+Check POA Network wiki for more info.`;
+constants.WRONG_NETWORK_MSG = `You aren't connected to POA Network.
+Please, switch on POA plugin and refresh the page.
+Check POA Network wiki for more info.`;
module.exports = {
constants
}
\ No newline at end of file
diff --git a/src/getWeb3.js b/src/getWeb3.js
index 8ce36d9..836a0d2 100644
--- a/src/getWeb3.js
+++ b/src/getWeb3.js
@@ -1,6 +1,4 @@
-let errorMsgNoMetamaskAccount = `You haven't chosen any account in MetaMask.
-Please, choose your initial key in MetaMask and reload the page.
-Check POA Network wiki for more info.`;
+import { constants } from "./constants";
let getWeb3 = () => {
return new Promise(function (resolve, reject) {
@@ -28,14 +26,12 @@ let getWeb3 = () => {
break;
default:
netIdName = 'ERROR'
- errorMsg = `You aren't connected to POA Network.
- Please, switch on POA plugin and refresh the page.
- Check POA Network wiki for more info.`
+ errorMsg = constants.WRONG_NETWORK_MSG
console.log('This is an unknown network.', netId)
}
var defaultAccount = web3.eth.defaultAccount || null;
if(defaultAccount === null){
- reject({message: errorMsgNoMetamaskAccount})
+ reject({message: constants.NO_METAMASK_MSG})
}
if(errorMsg !== null){
reject({message: errorMsg})
@@ -53,7 +49,7 @@ let getWeb3 = () => {
console.log('Injected web3 detected.');
} else {
- reject({message: errorMsgNoMetamaskAccount})
+ reject({message: constants.NO_METAMASK_MSG})
console.error('Metamask not found');
}
})
diff --git a/src/index.js b/src/index.js
index e5d34a0..89c2edc 100644
--- a/src/index.js
+++ b/src/index.js
@@ -55,11 +55,11 @@ class AppMainRouter extends Component {
console.log("miningKey", contractsStore.miningKey)
}).catch((error) => {
commonStore.hideLoading();
- console.error(error.message);
swal({
icon: 'error',
title: 'Error',
- content: generateElement(error.message)
+ html: error.message,
+ type: 'error'
});
});
}