769317777c
* Add specific dashboard route * Port application route to Octane * Fetch/sync contributors in application route, but only sync contributions in dashboard route for now
36 lines
885 B
JavaScript
36 lines
885 B
JavaScript
import Route from '@ember/routing/route';
|
|
import { inject as service } from '@ember/service';
|
|
import { schedule } from '@ember/runloop';
|
|
|
|
export default class ApplicationRoute extends Route {
|
|
|
|
@service kredits;
|
|
|
|
beforeModel(/* transition */) {
|
|
const kredits = this.kredits;
|
|
|
|
return kredits.setup().then(() => {
|
|
kredits.kredits.preflightChecks().catch((error) => {
|
|
console.error('Kredits preflight check failed!');
|
|
console.error(error);
|
|
});
|
|
}).catch((error) => {
|
|
console.log('Error initializing Kredits', error);
|
|
});
|
|
}
|
|
|
|
model() {
|
|
return this.kredits.loadInitialData().then(() => {
|
|
this.kredits.addContractEventHandlers()
|
|
});
|
|
}
|
|
|
|
afterModel() {
|
|
if (this.kredits.contributorsNeedSync) {
|
|
schedule('afterRender', this.kredits.syncContributors,
|
|
this.kredits.syncContributors.perform);
|
|
}
|
|
}
|
|
|
|
}
|