Skip to content

Commit

Permalink
Merge pull request #2280 from Bonymol-aot/bugfix/FWF-3757-added-formi…
Browse files Browse the repository at this point in the history
…o-call-anonymous-form

[FWF-3757: Added form title change after update, fixed pathname and anonymous url issues]
  • Loading branch information
arun-s-aot authored Oct 17, 2024
2 parents afce1e5 + 5c5a482 commit 747641a
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions forms-flow-web/src/components/Form/Item/Edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,17 @@ const Edit = React.memo(() => {
roles: rolesState.create.selectedOption === "specifiedRoles" ? rolesState.create.selectedRoles : [],
}
};
dispatch(saveFormProcessMapperPut({ mapper, authorizations }));
handleCloseModal();

const savePromise = dispatch(saveFormProcessMapperPut({ mapper, authorizations }));
const updatePromise = updateFormPath();

Promise.all([savePromise, updatePromise])
.then(() => {
handleCloseModal();
})
.catch(error => {
console.error("Error saving form process:", error);
});
};


Expand Down Expand Up @@ -388,6 +397,22 @@ const Edit = React.memo(() => {
});
};


const updateFormPath = () => {
const newFormData = manipulatingFormData(
_.cloneDeep(form),
MULTITENANCY_ENABLED,
tenantKey,
formAccess,
submissionAccess
);
newFormData.path = newPath;
newFormData.title = formDetails.name;
formUpdate(newFormData._id, newFormData);


};

const backToForm = () => {
dispatch(push(`${redirectUrl}form/`));
};
Expand Down

0 comments on commit 747641a

Please sign in to comment.