mirror of
https://gitlab.silvrtree.co.uk/martind2000/censis-archive.git
synced 2025-01-25 23:06:18 +00:00
34 lines
731 B
JavaScript
34 lines
731 B
JavaScript
import Ember from 'ember';
|
|
|
|
const { inject: { service }, RSVP } = Ember;
|
|
|
|
export default Ember.Route.extend({
|
|
sessionAccount: service('session-account'),
|
|
beforeModel() {
|
|
const cid = this.get('sessionAccount.account.memberof');
|
|
if (typeof cid === 'undefined' || cid === null) {
|
|
this.transitionTo('newcompany');
|
|
}
|
|
},
|
|
|
|
model: function() {
|
|
'use strict';
|
|
const cid = this.get('sessionAccount.account.memberof');
|
|
|
|
if (typeof cid !== 'undefined' && cid !== null) {
|
|
return new RSVP.Promise((resolve, reject) => {
|
|
return this.get('store').find('company', cid)
|
|
.then(resolve, reject);
|
|
});
|
|
|
|
} else {
|
|
|
|
return {
|
|
needNewCompany: true
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
});
|