github.com/blixtra/nomad@v0.7.2-0.20171221000451-da9a1d7bb050/ui/app/adapters/token.js (about)

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