Commit 4ad993a1 authored by Sergey Antonovich's avatar Sergey Antonovich 🇯🇵

Update jSynergy.js

parent dbe0319e
...@@ -1291,7 +1291,7 @@ function __classSynergy() { ...@@ -1291,7 +1291,7 @@ function __classSynergy() {
let modifiedComponentsList = __CLIENT__.getModifiedFormdata(); let modifiedComponentsList = __CLIENT__.getModifiedFormdata();
if (modifiedComponentsList.length) { if (modifiedComponentsList.length) {
let config = { let save = __CLIENT__.api('asforms/data/merge', {
type: 'POST', type: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
...@@ -1300,13 +1300,20 @@ function __classSynergy() { ...@@ -1300,13 +1300,20 @@ function __classSynergy() {
uuid: __CLIENT__.getDataUUID(), uuid: __CLIENT__.getDataUUID(),
data: modifiedComponentsList data: modifiedComponentsList
}) })
}; });
let save = __CLIENT__.api('asforms/data/merge', config);
if (save && +save.errorCode === 0) { if (save && +save.errorCode === 0) {
console.info('\n\n'); modifiedComponentsList.forEach(function(modifyComponent) {
console.info(__LIBRARY_PREFIX__ + '' + JSON.stringify(modifiedComponentsList)); const compIndex = __CLIENT__.getDefaultFormData().findIndex(function(component) {
return component.id === modifyComponent.id
})
if(compIndex !== -1) {
__CLIENT__.getDefaultFormData()[compIndex] = Object.assign({}, modifyComponent);
}
});
console.info('\n\n' + __LIBRARY_PREFIX__ + '' + JSON.stringify(modifiedComponentsList));
console.info( console.info(
__LIBRARY_PREFIX__ + 'Data changed successfully!' + __LIBRARY_PREFIX__ + 'Data changed successfully!' +
'\nNumber of components changed: ' + modifiedComponentsList.length + '\nNumber of components changed: ' + modifiedComponentsList.length +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment