open-vault/ui/app/adapters/ssh.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

25 lines
712 B
JavaScript

import { assert } from '@ember/debug';
import ApplicationAdapter from './application';
export default ApplicationAdapter.extend({
namespace: 'v1',
defaultSerializer: 'ssh',
url(/*role*/) {
assert('Override the `url` method to extend the SSH adapter', false);
},
createRecord(store, type, snapshot, requestType) {
const serializer = store.serializerFor(type.modelName);
const data = serializer.serialize(snapshot, requestType);
const role = snapshot.attr('role');
return this.ajax(this.url(role), 'POST', { data }).then(response => {
response.id = snapshot.id;
response.modelName = type.modelName;
store.pushPayload(type.modelName, response);
});
},
});