2016-05-24 15:06:59 +03:00
|
|
|
import ApplicationAdapter from 'ghost-admin/adapters/application';
|
2014-06-20 06:29:49 +04:00
|
|
|
|
2022-02-02 19:57:22 +03:00
|
|
|
export default class Setting extends ApplicationAdapter {
|
2015-10-28 14:36:45 +03:00
|
|
|
updateRecord(store, type, record) {
|
|
|
|
let data = {};
|
|
|
|
let serializer = store.serializerFor(type.modelName);
|
2014-06-20 06:29:49 +04:00
|
|
|
|
|
|
|
// remove the fake id that we added onto the model.
|
|
|
|
delete record.id;
|
|
|
|
|
|
|
|
// use the SettingSerializer to transform the model back into
|
|
|
|
// an array of settings objects like the API expects
|
|
|
|
serializer.serializeIntoHash(data, type, record);
|
|
|
|
|
|
|
|
// use the ApplicationAdapter's buildURL method but do not
|
|
|
|
// pass in an id.
|
2015-10-28 14:36:45 +03:00
|
|
|
return this.ajax(this.buildURL(type.modelName), 'PUT', {data});
|
2014-06-20 06:29:49 +04:00
|
|
|
}
|
2022-02-02 19:57:22 +03:00
|
|
|
}
|