Ask user to unlock their account #23
@@ -5,6 +5,20 @@ export default Ember.Route.extend({
|
||||
|
||||
kredits: Ember.inject.service(),
|
||||
|
||||
beforeModel(transition) {
|
||||
const kredits = this.get('kredits');
|
||||
|
||||
if (kredits.get('web3') && kredits.get('web3Provided')) {
|
||||
|
|
||||
kredits.get('web3').eth.getAccounts((error, accounts) => {
|
||||
if (error || accounts.length === 0) {
|
||||
if (confirm('Please unlock your accounts')) {
|
||||
transition.retry();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
model() {
|
||||
let kredits = this.get('kredits');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user
Wouldn't the second condition be enough here?
No, because the
web3property actually checks if there is a user provided web3 when called for the first time. And it's not being called before this, so we have to access it first.