Refactor controller and route

I’m not sure how the queryParams are used so I removed them. I’m happy to readd them.
This commit is contained in:
2018-04-08 01:57:54 +02:00
parent cc7c47cbab
commit 45044c0f61
2 changed files with 25 additions and 52 deletions
+8 -30
View File
@@ -1,37 +1,15 @@
import Ember from 'ember';
import Proposal from 'kredits-web/models/proposal';
const {
Route,
RSVP,
inject: {
service
}
} = Ember;
import injectService from 'ember-service/inject';
import Route from 'ember-route';
export default Route.extend({
kredits: service(),
model(params) {
const proposal = Proposal.create({
recipientAddress: params.recipient,
amount: params.amount,
url: params.url,
kind: params.kind || 'dev',
ipfsHash: params.ipfsHash
});
return RSVP.hash({
proposal,
contributors: this.get('kredits').getContributors()
});
},
kredits: injectService(),
setupController(controller, model) {
this._super(controller, model.proposal);
this._super(...arguments);
controller.set('contributors', model.contributors);
this.get('kredits').getContributors()
.then((contributors) => {
this.controller.set('contributors', contributors);
});
}
});