From a0cd301415d60825ba2897e8609163d833160eea Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Tue, 4 Feb 2020 14:44:28 +0200 Subject: [PATCH] Intro switch form fixed to replace the location --- src/routes/Intro/Intro.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/routes/Intro/Intro.js b/src/routes/Intro/Intro.js index 5efe36cdd..4e4be4482 100644 --- a/src/routes/Intro/Intro.js +++ b/src/routes/Intro/Intro.js @@ -230,6 +230,11 @@ const Intro = ({ queryParams }) => { const toggleMarketingAccepted = React.useCallback(() => { dispatch({ type: 'toggle-checkbox', name: 'marketingAccepted' }); }, []); + const switchFormOnClick = React.useCallback(() => { + const nextQueryParams = new URLSearchParams(queryParams); + nextQueryParams.set('form', state.form === SIGNUP_FORM ? LOGIN_FORM : SIGNUP_FORM); + window.location.replace(`#/intro?${nextQueryParams}`); + }, [queryParams, state.form]); React.useEffect(() => { if ([LOGIN_FORM, SIGNUP_FORM].includes(queryParams.get('form'))) { dispatch({ type: 'set-form', form: queryParams.get('form') }); @@ -331,7 +336,7 @@ const Intro = ({ queryParams }) => { : null } -