Skip to content

Commit

Permalink
Fix redirect after submit
Browse files Browse the repository at this point in the history
Fixes: AFORM-3907
  • Loading branch information
trungnd-optimizely committed Jul 11, 2024
1 parent d66e015 commit ec2f25c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/@episerver/forms-react/src/components/FormBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,9 @@ export const FormBody = (props: FormBodyProps) => {
if (submitButton) {
let redirectToPage = submitButton?.properties?.redirectToPage ?? form.properties?.redirectToPage;
if (!isNullOrEmpty(redirectToPage)) {
let url = new URL(redirectToPage, "http://temp");
props.history && props.history.push(url.pathname);
var cmsUrl = process.env.REACT_APP_HEADLESS_FORM_BASE_URL ?? "http://temp";
let url = new URL(redirectToPage, cmsUrl);
window.location.replace(url.href);
}
}
}).catch((e: ProblemDetail) => {
Expand Down

0 comments on commit ec2f25c

Please sign in to comment.