From f5112b5b2a587bfcfb2c81d5b10a91b04d09cf85 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 24 Sep 2021 12:36:51 -0500 Subject: [PATCH] RegistrationForm: redirect home on success (if not already) --- .../features/auth_login/components/registration_form.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/soapbox/features/auth_login/components/registration_form.js b/app/soapbox/features/auth_login/components/registration_form.js index 704ce4840..3ea8f6d62 100644 --- a/app/soapbox/features/auth_login/components/registration_form.js +++ b/app/soapbox/features/auth_login/components/registration_form.js @@ -54,6 +54,10 @@ class RegistrationForm extends ImmutablePureComponent { inviteToken: PropTypes.string, } + static contextTypes = { + router: PropTypes.object, + }; + state = { captchaLoading: true, submissionLoading: false, @@ -98,11 +102,14 @@ class RegistrationForm extends ImmutablePureComponent { postRegisterAction = ({ access_token }) => { const { dispatch, needsConfirmation, needsApproval } = this.props; + const { router } = this.context; if (needsConfirmation || needsApproval) { return this.launchModal(); } else { - return dispatch(verifyCredentials(access_token)); + return dispatch(verifyCredentials(access_token)).then(() => { + router.history.push('/'); + }); } }