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,
|
inviteToken: PropTypes.string,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static contextTypes = {
|
||||||
|
router: PropTypes.object,
|
||||||
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
captchaLoading: true,
|
captchaLoading: true,
|
||||||
submissionLoading: false,
|
submissionLoading: false,
|
||||||
|
@ -98,11 +102,14 @@ class RegistrationForm extends ImmutablePureComponent {
|
||||||
|
|
||||||
postRegisterAction = ({ access_token }) => {
|
postRegisterAction = ({ access_token }) => {
|
||||||
const { dispatch, needsConfirmation, needsApproval } = this.props;
|
const { dispatch, needsConfirmation, needsApproval } = this.props;
|
||||||
|
const { router } = this.context;
|
||||||
|
|
||||||
if (needsConfirmation || needsApproval) {
|
if (needsConfirmation || needsApproval) {
|
||||||
return this.launchModal();
|
return this.launchModal();
|
||||||
} else {
|
} else {
|
||||||
return dispatch(verifyCredentials(access_token));
|
return dispatch(verifyCredentials(access_token)).then(() => {
|
||||||
|
router.history.push('/');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue