2015-10-18 21:17:02 +03:00
|
|
|
import Ember from 'ember';
|
|
|
|
import SessionService from 'ember-simple-auth/services/session';
|
|
|
|
|
2016-01-19 16:03:27 +03:00
|
|
|
const {
|
|
|
|
computed,
|
|
|
|
inject: {service}
|
|
|
|
} = Ember;
|
2015-10-28 14:36:45 +03:00
|
|
|
|
2015-10-18 21:17:02 +03:00
|
|
|
export default SessionService.extend({
|
2016-01-19 16:03:27 +03:00
|
|
|
store: service(),
|
2016-05-05 17:03:09 +03:00
|
|
|
feature: service(),
|
2015-10-18 21:17:02 +03:00
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
user: computed(function () {
|
2015-10-18 21:17:02 +03:00
|
|
|
return this.get('store').findRecord('user', 'me');
|
2016-05-05 17:03:09 +03:00
|
|
|
}),
|
|
|
|
|
|
|
|
authenticate() {
|
|
|
|
return this._super(...arguments).then((authResult) => {
|
|
|
|
return this.get('feature').fetch().then(() => {
|
|
|
|
return authResult;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2015-10-18 21:17:02 +03:00
|
|
|
});
|