From a0621725e7a75778121e095376732a00366473ce Mon Sep 17 00:00:00 2001 From: Trung Nguyen Duc Date: Thu, 11 Jul 2024 12:57:56 +0700 Subject: [PATCH] Fix redirect after submit Fixes: AFORM-3907 --- src/@episerver/forms-react/src/components/FormBody.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/@episerver/forms-react/src/components/FormBody.tsx b/src/@episerver/forms-react/src/components/FormBody.tsx index 6ae01fa..fff4017 100644 --- a/src/@episerver/forms-react/src/components/FormBody.tsx +++ b/src/@episerver/forms-react/src/components/FormBody.tsx @@ -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.href = url.href; } } }).catch((e: ProblemDetail) => {