Skip to content

Commit

Permalink
get message from api
Browse files Browse the repository at this point in the history
  • Loading branch information
hungoptimizely committed Dec 12, 2023
1 parent 500bdc1 commit e9e1f15
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/@episerver/forms-react/src/components/FormBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ export const FormBody = (props: FormBodyProps) => {

formSubmitter.doSubmit(model).then((response: FormSubmitResult)=>{
if(response.success){
message.current = "The form has been submitted successfully.";
message.current = response.messages.map(m => m.message).join("<br>");
}
else {
submissionWarning.current = true;
//ignore validation message
message.current = response.errors.filter(e => isNullOrEmpty(e.identifier)).map(e => e.message).join("<br>");
message.current = response.messages.filter(m => isNullOrEmpty(m.identifier)).map(m => m.message).join("<br>");
}
validateFail.current = response.validationFail;
isFormFinalized.current = isSuccess.current = response.success;
Expand Down
6 changes: 3 additions & 3 deletions src/@episerver/forms-sdk/src/form-submit/formSubmit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ export interface FormSubmitResult {
*/
validationFail: boolean;
/**
* List of error messages from the form submission.
* List of messages from the form submission.
*/
errors: FormSubmitError[];
messages: FormSubmitMessage[];
}

export interface FormSubmitError {
export interface FormSubmitMessage {
/**
* The section where the message originated from.
*/
Expand Down

0 comments on commit e9e1f15

Please sign in to comment.