mirror of
https://gitlab.silvrtree.co.uk/martind2000/project.git
synced 2025-01-10 23:35:08 +00:00
24 lines
590 B
JavaScript
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;
|
|
}
|
|
}
|
|
});
|