2017-12-15 21:39:18 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
2017-10-13 22:17:51 +00:00
|
|
|
import { default as ApplicationAdapter, namespace } from './application';
|
|
|
|
|
|
|
|
export default ApplicationAdapter.extend({
|
2017-12-15 21:39:18 +00:00
|
|
|
store: service(),
|
2017-10-14 19:42:14 +00:00
|
|
|
|
2017-10-13 22:17:51 +00:00
|
|
|
namespace: namespace + '/acl',
|
2017-10-14 19:42:14 +00:00
|
|
|
|
|
|
|
findSelf() {
|
2018-08-10 01:21:07 +00:00
|
|
|
return this.ajax(`${this.buildURL()}/token/self`, 'GET').then(token => {
|
2017-10-14 19:42:14 +00:00
|
|
|
const store = this.get('store');
|
|
|
|
store.pushPayload('token', {
|
|
|
|
tokens: [token],
|
|
|
|
});
|
|
|
|
|
|
|
|
return store.peekRecord('token', store.normalize('token', token).data.id);
|
|
|
|
});
|
|
|
|
},
|
2017-10-13 22:17:51 +00:00
|
|
|
});
|