Block in application route if accountNeedsUnlock

The index route never gets invoked if you reload on the proposal page. That change makes sure we always initialize `ethProvider`.
This commit was merged in pull request #35.
This commit is contained in:
2018-04-08 00:31:07 +02:00
committed by Michael Bumann
parent 206c657b98
commit d8951caddb
2 changed files with 16 additions and 13 deletions
+16 -2
View File
@@ -1,4 +1,18 @@
import Ember from 'ember';
import injectService from 'ember-service/inject';
import Route from 'ember-route';
export default Ember.Route.extend({
export default Route.extend({
kredits: injectService(),
beforeModel(transition) {
const kredits = this.get('kredits');
return kredits.initEthProvider().then(() => {
if (kredits.get('accountNeedsUnlock')) {
if (confirm('It looks like you have an Ethereum wallet available. Please unlock your account.')) {
transition.retry();
}
}
});
},
});