project/app/routes/newcompany.js
Martin Donnelly e06e53e5bd whats wrong?
2016-04-06 16:53:06 +01:00

24 lines
590 B
JavaScript

import Ember from 'ember';
const { inject: { service }, RSVP } = Ember;
export default Ember.Route.extend({
sessionAccount: service('session-account'),
model: function() {
'use strict';
const cid = this.get('sessionAccount.account.memberOf');
if (typeof cid !== 'undefined') {
return new RSVP.Promise((resolve, reject) => {
return this.get('store').find('company', cid)
.then(resolve, reject);
});
} else {
var newPage = this.store.createRecord('newcompany',{});
newPage.set('cid', cid);
return newPage;
}
}
});