refactoring; saving first paragraph contentEditable
This commit is contained in:
@@ -49,9 +49,13 @@ export default {
|
||||
// console.log('save csrf_token', this.csrf_token);
|
||||
const params = {
|
||||
type: this.data.bundle,
|
||||
nid: [{"value":this.data.nid}],
|
||||
[this.data.field.field_name]: [{[this.data.field.value]: content}]
|
||||
};
|
||||
if (this.data.entitytype === 'node') {
|
||||
params.nid = [{"value":this.data.id}];
|
||||
} else {
|
||||
params.id = [{"value":this.data.id}];
|
||||
}
|
||||
// we need additional values for image alt for example
|
||||
// console.log('additional_values', this.data.field.additional_values);
|
||||
if (this.data.field.additional_values) {
|
||||
@@ -61,10 +65,13 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const configs = {
|
||||
headers: {'X-CSRF-Token': this.csrf_token}
|
||||
};
|
||||
REST.patch(`/${this.data.entitytype}/${this.data.nid}?_format=json`, params, configs)
|
||||
|
||||
let url_base = `/${this.data.entitytype === 'node' ? '' : 'entity/'}${this.data.entitytype}`;
|
||||
REST.patch(`${url_base}/${this.data.id}?_format=json`, params, configs)
|
||||
.then(({ data }) => {
|
||||
console.log('user REST post node data', data)
|
||||
// TODO if success update the data in pinia
|
||||
|
||||
Reference in New Issue
Block a user