Ghost/ghost/admin/app/services/session.js
Kevin Ansfield 2da6673197 Synchronous feature service
supersedes #6773
- update `feature` service and `gh-feature-flag` component to work synchronously rather than async
- use the application route's `afterModel` hook so that settings are loaded before first load
- override `session` service's `authenticate` method to load the settings after successful authentication before any other routes are processed
2016-05-07 15:00:06 +02:00

25 lines
554 B
JavaScript

import Ember from 'ember';
import SessionService from 'ember-simple-auth/services/session';
const {
computed,
inject: {service}
} = Ember;
export default SessionService.extend({
store: service(),
feature: service(),
user: computed(function () {
return this.get('store').findRecord('user', 'me');
}),
authenticate() {
return this._super(...arguments).then((authResult) => {
return this.get('feature').fetch().then(() => {
return authResult;
});
});
}
});