mirror of
https://gitlab.silvrtree.co.uk/martind2000/project.git
synced 2025-01-10 23:35:08 +00:00
25 lines
586 B
JavaScript
25 lines
586 B
JavaScript
import Ember from 'ember';
|
|
|
|
const { inject: { service }, RSVP } = Ember;
|
|
|
|
export default Ember.Service.extend({
|
|
session: service('session'),
|
|
store: service(),
|
|
|
|
loadCurrentUser() {
|
|
return new RSVP.Promise((resolve, reject) => {
|
|
const accountId = this.get('session.data.authenticated.account_id');
|
|
|
|
if (!Ember.isEmpty(accountId)) {
|
|
|
|
return this.get('store').find('account', accountId).then((account) => {
|
|
this.set('account', account);
|
|
return resolve();
|
|
}, reject);
|
|
} else {
|
|
return resolve();
|
|
}
|
|
});
|
|
}
|
|
});
|