2017-05-29 21:50:03 +03:00
|
|
|
import SessionService from 'ember-simple-auth/services/session';
|
2017-08-22 10:53:26 +03:00
|
|
|
import {computed} from '@ember/object';
|
2017-10-30 12:38:01 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
2015-10-18 21:17:02 +03:00
|
|
|
|
|
|
|
export default SessionService.extend({
|
2019-01-02 12:58:55 +03:00
|
|
|
dataStore: service('store'), // SessionService.store already exists
|
2015-10-18 21:17:02 +03:00
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
user: computed(function () {
|
2019-03-06 16:53:54 +03:00
|
|
|
return this.dataStore.queryRecord('user', {id: 'me'});
|
2016-05-05 17:03:09 +03:00
|
|
|
}),
|
|
|
|
|
|
|
|
authenticate() {
|
2019-03-25 15:58:14 +03:00
|
|
|
// ensure any cached this.user value is removed and re-fetched
|
|
|
|
this.notifyPropertyChange('user');
|
|
|
|
|
2019-08-12 11:11:10 +03:00
|
|
|
return this._super(...arguments);
|
2016-05-05 17:03:09 +03:00
|
|
|
}
|
2015-10-18 21:17:02 +03:00
|
|
|
});
|