RegistrationForm: redirect home on success (if not already)

v1.x.x
Alex Gleason 2021-09-24 12:36:51 -05:00
rodzic b18ed0d0e9
commit f5112b5b2a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -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('/');
});
}
}