mirror of
https://github.com/status-im/hackathon-registration-dapp.git
synced 2025-02-21 16:48:17 +00:00
Testing if alert messages appear in Status
This commit is contained in:
parent
015b911b08
commit
fc5398fddf
@ -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;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user