consul/ui-v2/app/services/data-sink/protocols/http.js

22 lines
657 B
JavaScript

import Service, { inject as service } from '@ember/service';
import { setProperties } from '@ember/object';
export default Service.extend({
settings: service('settings'),
intention: service('repository/intention'),
session: service('repository/session'),
prepare: function(sink, data, instance) {
return setProperties(instance, data);
},
persist: function(sink, instance) {
const [, , , model] = sink.split('/');
const repo = this[model];
return repo.persist(instance);
},
remove: function(sink, instance) {
const [, , , model] = sink.split('/');
const repo = this[model];
return repo.remove(instance);
},
});