Skip to content

Commit

Permalink
fix: bug contribution validation sur page non editable (#1075)
Browse files Browse the repository at this point in the history
Co-authored-by: Victor Zeinstra <[email protected]>
  • Loading branch information
Viczei and Victor Zeinstra authored Oct 10, 2023
1 parent 46878a8 commit b63771a
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,18 @@ export const AnswerForm = ({
});

const submit = async (newStatus: Status) => {
const isValid = await trigger();

if (isValid) {
setStatus(newStatus);
const formData = getValues();
onSubmit(newStatus, {
...answer,
...formData,
});
if (!isNotEditable(answer)) {
const isValid = await trigger();
if (!isValid) {
return;
}
}
const formData = getValues();
setStatus(newStatus);
onSubmit(newStatus, {
...answer,
...formData,
});
};

const agreementResponseOptions = [
Expand Down

0 comments on commit b63771a

Please sign in to comment.