mirror of
https://github.com/status-im/consul.git
synced 2025-01-11 14:24:39 +00:00
12811c0844
* Add some tests to check the correct GET API endpoints are called * Refactor adapters 1. Add integration tests for `urlFor...` and majority `handleResponse` methods 2. Refactor out `handleResponse` a little more into single/batch/boolean methods 3. Move setting of the `Datacenter` property into the `handleResponse` method, basically the same place that the uid is being set using the dc parsed form the URL 4. Add some Errors for if you don't pass ids to certain `urlFor` methods
24 lines
560 B
JavaScript
24 lines
560 B
JavaScript
import Service, { inject as service } from '@ember/service';
|
|
import { get } from '@ember/object';
|
|
|
|
export default Service.extend({
|
|
store: service('store'),
|
|
findByNode: function(node, dc) {
|
|
return get(this, 'store').query('session', {
|
|
id: node,
|
|
dc: dc,
|
|
});
|
|
},
|
|
findByKey: function(slug, dc) {
|
|
return get(this, 'store').queryRecord('session', {
|
|
id: slug,
|
|
dc: dc,
|
|
});
|
|
},
|
|
remove: function(item) {
|
|
return item.destroyRecord().then(item => {
|
|
return get(this, 'store').unloadRecord(item);
|
|
});
|
|
},
|
|
});
|