github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/ui/app/adapters/token.js (about)

     1  import { inject as service } from '@ember/service';
     2  import { default as ApplicationAdapter, namespace } from './application';
     3  
     4  export default class TokenAdapter extends ApplicationAdapter {
     5    @service store;
     6  
     7    namespace = namespace + '/acl';
     8  
     9    findSelf() {
    10      return this.ajax(`${this.buildURL()}/token/self`, 'GET').then(token => {
    11        const store = this.store;
    12        store.pushPayload('token', {
    13          tokens: [token],
    14        });
    15  
    16        return store.peekRecord('token', store.normalize('token', token).data.id);
    17      });
    18    }
    19  }