Testing if alert messages appear in Status

This commit is contained in:
Richard Ramos 2018-10-19 17:24:33 -04:00
parent 015b911b08
commit fc5398fddf

View File

@ -28,14 +28,17 @@ class App extends React.Component {
} }
componentDidMount(){ componentDidMount(){
window.addEventListener('load', async () => { EmbarkJS.onReady(async (error) => {
alert(1);
// Modern dapp browsers... // Modern dapp browsers...
if (window.ethereum) { if (window.ethereum) {
alert(2);
window.web3 = new Web3(ethereum); window.web3 = new Web3(ethereum);
try { try {
alert(3);
// Request account access if needed // Request account access if needed
await ethereum.enable(); await ethereum.enable();
alert(4);
this.setup(); this.setup();
} catch (error) { } catch (error) {
alert('Access to ETH wallet required to send funds'); alert('Access to ETH wallet required to send funds');
@ -54,7 +57,6 @@ class App extends React.Component {
} }
setup(){ setup(){
EmbarkJS.onReady(async (error) => {
const accounts = await web3.eth.getAccounts(); const accounts = await web3.eth.getAccounts();
if(!accounts.length){ if(!accounts.length){
@ -81,7 +83,6 @@ class App extends React.Component {
alert(error); alert(error);
return; return;
} }
});
} }