From 630874d3abce63df6f1dad3d2d09497219f4153e Mon Sep 17 00:00:00 2001 From: Michael Kret Date: Mon, 11 Nov 2024 10:04:24 +0200 Subject: [PATCH] fix --- packages/cli/src/response-helper.ts | 8 ++ .../cli/templates/form-trigger-409.handlebars | 74 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 packages/cli/templates/form-trigger-409.handlebars diff --git a/packages/cli/src/response-helper.ts b/packages/cli/src/response-helper.ts index 0dff1625cb..2b993c266c 100644 --- a/packages/cli/src/response-helper.ts +++ b/packages/cli/src/response-helper.ts @@ -103,6 +103,14 @@ export function sendErrorResponse(res: Response, error: Error) { } } + if (error.errorCode === 409 && originalUrl && originalUrl.includes('form-waiting')) { + //codes other than 200 breaks redirection to form-waiting page from form trigger + //render form page instead of json + return res.render('form-trigger-409', { + message: error.message, + }); + } + httpStatusCode = error.httpStatusCode; if (error.errorCode) { diff --git a/packages/cli/templates/form-trigger-409.handlebars b/packages/cli/templates/form-trigger-409.handlebars new file mode 100644 index 0000000000..6f34e5080d --- /dev/null +++ b/packages/cli/templates/form-trigger-409.handlebars @@ -0,0 +1,74 @@ + + + + + + + + Problem loading form + + + + +
+
+
+
+

Problem loading form

+

{{message}}

+
+
+ +
+
+ + + \ No newline at end of file