Redirect after signing up, fixes #620
This commit is contained in:
parent
5cfd8106dd
commit
ccac733e48
|
@ -204,8 +204,9 @@ export function register(params) {
|
||||||
|
|
||||||
return dispatch(createAppAndToken()).then(() => {
|
return dispatch(createAppAndToken()).then(() => {
|
||||||
return dispatch(createAccount(params));
|
return dispatch(createAccount(params));
|
||||||
}).then(token => {
|
}).then(({ token }) => {
|
||||||
return dispatch(authLoggedIn(token));
|
dispatch(authLoggedIn(token));
|
||||||
|
return token;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,11 @@ import {
|
||||||
SimpleTextarea,
|
SimpleTextarea,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
} from 'soapbox/features/forms';
|
} from 'soapbox/features/forms';
|
||||||
import { register } from 'soapbox/actions/auth';
|
import { register, verifyCredentials } from 'soapbox/actions/auth';
|
||||||
import CaptchaField from 'soapbox/features/auth_login/components/captcha';
|
import CaptchaField from 'soapbox/features/auth_login/components/captcha';
|
||||||
import { Map as ImmutableMap } from 'immutable';
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import { getSettings } from 'soapbox/actions/settings';
|
import { getSettings } from 'soapbox/actions/settings';
|
||||||
import { fetchMe } from 'soapbox/actions/me';
|
|
||||||
import { openModal } from 'soapbox/actions/modal';
|
import { openModal } from 'soapbox/actions/modal';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
|
@ -90,13 +89,13 @@ class RegistrationForm extends ImmutablePureComponent {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
postRegisterAction = () => {
|
postRegisterAction = ({ access_token }) => {
|
||||||
const { dispatch, needsConfirmation, needsApproval } = this.props;
|
const { dispatch, needsConfirmation, needsApproval } = this.props;
|
||||||
|
|
||||||
if (needsConfirmation || needsApproval) {
|
if (needsConfirmation || needsApproval) {
|
||||||
return this.launchModal();
|
return this.launchModal();
|
||||||
} else {
|
} else {
|
||||||
return dispatch(fetchMe());
|
return dispatch(verifyCredentials(access_token));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,9 +105,9 @@ class RegistrationForm extends ImmutablePureComponent {
|
||||||
|
|
||||||
this.setState({ submissionLoading: true });
|
this.setState({ submissionLoading: true });
|
||||||
|
|
||||||
dispatch(register(params.toJS())).then(() => {
|
dispatch(register(params.toJS()))
|
||||||
this.postRegisterAction();
|
.then(this.postRegisterAction)
|
||||||
}).catch(error => {
|
.catch(error => {
|
||||||
this.setState({ submissionLoading: false });
|
this.setState({ submissionLoading: false });
|
||||||
this.refreshCaptcha();
|
this.refreshCaptcha();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue