kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
RegistrationForm: redirect home on success (if not already)
rodzic
b18ed0d0e9
commit
f5112b5b2a
|
@ -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('/');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue