open-vault/ui/app/adapters/capabilities.js
Matthew Irish d509588cd2
Ember update (#5386)
Ember update - update ember-cli, ember-data, and ember to 3.4 series
2018-09-25 11:28:26 -05:00

27 lines
649 B
JavaScript

import { set } from '@ember/object';
import ApplicationAdapter from './application';
import DS from 'ember-data';
export default ApplicationAdapter.extend({
pathForType() {
return 'capabilities-self';
},
findRecord(store, type, id) {
return this.ajax(this.buildURL(type), 'POST', { data: { paths: [id] } }).catch(e => {
if (e instanceof DS.AdapterError) {
set(e, 'policyPath', 'sys/capabilities-self');
}
throw e;
});
},
queryRecord(store, type, query) {
const { id } = query;
return this.findRecord(store, type, id).then(resp => {
resp.path = id;
return resp;
});
},
});