admin front: entite active boolean

This commit is contained in:
2024-10-04 15:46:36 +02:00
parent 984ec07084
commit d6b3bdf2aa
7 changed files with 253 additions and 108 deletions

View File

@@ -38,17 +38,24 @@ export default {
},
save(checked){
// console.log('save csrf_token', this.csrf_token);
const params = {
let params = {
type: this.data.bundle,
nid: [{"value":this.data.nid}],
// nid: [{"value":this.data.nid}],
[this.data.field]: {value: checked}
};
if (this.data.entitytype === 'node') {
params.nid = [{"value":this.data.id}];
} else {
params.id = [{"value":this.data.id}];
}
const configs = {
headers: {'X-CSRF-Token': this.csrf_token}
};
REST.patch(`/node/${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)
console.log(`checkboxEditable REST patch ${this.data.entitytype} data`, data)
// TODO if success update the data in pinia
// this.reloadConcernements();
this.$emit('updated');