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; } } });