From 9386ee04c2c18f0e2a898cddbb2566775c2d7663 Mon Sep 17 00:00:00 2001 From: Steven Bal Date: Thu, 10 Oct 2024 12:34:33 +0200 Subject: [PATCH] :recycle: [#4398] Pass initial data ref to backend via login URL previously it was attempted to grab this from the query params, but the parameter was not set anymore at the time it was actually needed (when sending the submission create request, after authentication) --- src/components/Form.js | 7 ++++++- src/components/FormStart/index.js | 8 ++++++-- src/components/IntroductionPage/index.js | 6 ++++-- src/components/LoginOptions/index.js | 5 +++-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/components/Form.js b/src/components/Form.js index d43c0056d..462db1a2b 100644 --- a/src/components/Form.js +++ b/src/components/Form.js @@ -359,7 +359,11 @@ const Form = () => { element={} /> - } /> + } + /> { submission={state.submission} onFormStart={onFormStart} onDestroySession={onDestroySession} + initialDataReference={initialDataReference} /> } diff --git a/src/components/FormStart/index.js b/src/components/FormStart/index.js index ae0fc9679..70acd9940 100644 --- a/src/components/FormStart/index.js +++ b/src/components/FormStart/index.js @@ -41,7 +41,7 @@ const FormStartMessage = ({form}) => { * This is shown when the form is initially loaded and provides the explicit user * action to start the form, or present the login button (DigiD, eHerkenning...) */ -const FormStart = ({form, submission, onFormStart, onDestroySession}) => { +const FormStart = ({form, submission, onFormStart, onDestroySession, initialDataReference}) => { const hasActiveSubmission = !!submission; const isAuthenticated = hasActiveSubmission && submission.isAuthenticated; const doStart = useStartSubmission(); @@ -121,7 +121,11 @@ const FormStart = ({form, submission, onFormStart, onDestroySession}) => { isAuthenticated={isAuthenticated} /> ) : ( - + )} diff --git a/src/components/IntroductionPage/index.js b/src/components/IntroductionPage/index.js index 55337dca2..ecd490d23 100644 --- a/src/components/IntroductionPage/index.js +++ b/src/components/IntroductionPage/index.js @@ -8,11 +8,13 @@ import Body from 'components/Body'; import Card from 'components/Card'; import Link from 'components/Link'; -const IntroductionPage = () => { +const IntroductionPage = ({extraParams = {}}) => { const {name, introductionPageContent = ''} = useContext(FormContext); if (!introductionPageContent) { return ; } + let startUrl = '/startpagina'; + if (extraParams) startUrl = `${startUrl}?${new URLSearchParams(extraParams).toString()}`; return ( { dangerouslySetInnerHTML={{__html: introductionPageContent}} /> - + { +const LoginOptions = ({form, onFormStart, extraParams = {}}) => { const config = useContext(ConfigContext); const loginAsYourselfOptions = []; @@ -18,7 +18,7 @@ const LoginOptions = ({form, onFormStart}) => { form.loginOptions.forEach(option => { let readyOption = {...option}; - readyOption.url = getLoginUrl(option); + readyOption.url = getLoginUrl(option, extraParams); readyOption.label = ( { LoginOptions.propTypes = { form: Types.Form.isRequired, onFormStart: PropTypes.func.isRequired, + extraParams: PropTypes.object, }; export default LoginOptions;