|
@@ -49,9 +49,13 @@ export default {
|
|
// console.log('save csrf_token', this.csrf_token);
|
|
// console.log('save csrf_token', this.csrf_token);
|
|
const params = {
|
|
const params = {
|
|
type: this.data.bundle,
|
|
type: this.data.bundle,
|
|
- nid: [{"value":this.data.nid}],
|
|
|
|
[this.data.field.field_name]: [{[this.data.field.value]: content}]
|
|
[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
|
|
// we need additional values for image alt for example
|
|
// console.log('additional_values', this.data.field.additional_values);
|
|
// console.log('additional_values', this.data.field.additional_values);
|
|
if (this.data.field.additional_values) {
|
|
if (this.data.field.additional_values) {
|
|
@@ -61,10 +65,13 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
const configs = {
|
|
const configs = {
|
|
headers: {'X-CSRF-Token': this.csrf_token}
|
|
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 }) => {
|
|
.then(({ data }) => {
|
|
console.log('user REST post node data', data)
|
|
console.log('user REST post node data', data)
|
|
// TODO if success update the data in pinia
|
|
// TODO if success update the data in pinia
|