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';
|
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
export default class Token extends ApplicationAdapter {
|
|
|
|
@service store;
|
2017-10-14 19:42:14 +00:00
|
|
|
|
2020-06-10 13:49:16 +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 => {
|
2019-03-26 07:46:44 +00:00
|
|
|
const store = this.store;
|
2017-10-14 19:42:14 +00:00
|
|
|
store.pushPayload('token', {
|
|
|
|
tokens: [token],
|
|
|
|
});
|
|
|
|
|
|
|
|
return store.peekRecord('token', store.normalize('token', token).data.id);
|
|
|
|
});
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
|
|
|
}
|