fix: Unable to save automation "send email to team" (#6052)
* fix: Unable to save automation "send email to team" * chore: Minor fixes
This commit is contained in:
parent
823c836906
commit
86958278cd
1 changed files with 10 additions and 1 deletions
|
@ -17,13 +17,22 @@ const formatArray = params => {
|
||||||
return params;
|
return params;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const generatePayloadForObject = item => {
|
||||||
|
if (item.action_params.id) {
|
||||||
|
item.action_params = [item.action_params.id];
|
||||||
|
} else {
|
||||||
|
item.action_params = [item.action_params];
|
||||||
|
}
|
||||||
|
return item.action_params;
|
||||||
|
};
|
||||||
|
|
||||||
const generatePayload = data => {
|
const generatePayload = data => {
|
||||||
const actions = JSON.parse(JSON.stringify(data));
|
const actions = JSON.parse(JSON.stringify(data));
|
||||||
let payload = actions.map(item => {
|
let payload = actions.map(item => {
|
||||||
if (Array.isArray(item.action_params)) {
|
if (Array.isArray(item.action_params)) {
|
||||||
item.action_params = formatArray(item.action_params);
|
item.action_params = formatArray(item.action_params);
|
||||||
} else if (typeof item.action_params === 'object') {
|
} else if (typeof item.action_params === 'object') {
|
||||||
item.action_params = [item.action_params.id];
|
item.action_params = generatePayloadForObject(item);
|
||||||
} else if (!item.action_params) {
|
} else if (!item.action_params) {
|
||||||
item.action_params = [];
|
item.action_params = [];
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue