diff --git a/app/soapbox/actions/auth.js b/app/soapbox/actions/auth.js index dbbf91407..80956ec6f 100644 --- a/app/soapbox/actions/auth.js +++ b/app/soapbox/actions/auth.js @@ -204,8 +204,9 @@ export function register(params) { return dispatch(createAppAndToken()).then(() => { return dispatch(createAccount(params)); - }).then(token => { - return dispatch(authLoggedIn(token)); + }).then(({ token }) => { + dispatch(authLoggedIn(token)); + return token; }); }; } diff --git a/app/soapbox/features/landing_page/components/registration_form.js b/app/soapbox/features/landing_page/components/registration_form.js index 4f862c587..808e9d56f 100644 --- a/app/soapbox/features/landing_page/components/registration_form.js +++ b/app/soapbox/features/landing_page/components/registration_form.js @@ -12,12 +12,11 @@ import { SimpleTextarea, Checkbox, } 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 { Map as ImmutableMap } from 'immutable'; import { v4 as uuidv4 } from 'uuid'; import { getSettings } from 'soapbox/actions/settings'; -import { fetchMe } from 'soapbox/actions/me'; import { openModal } from 'soapbox/actions/modal'; const messages = defineMessages({ @@ -90,13 +89,13 @@ class RegistrationForm extends ImmutablePureComponent { })); } - postRegisterAction = () => { + postRegisterAction = ({ access_token }) => { const { dispatch, needsConfirmation, needsApproval } = this.props; if (needsConfirmation || needsApproval) { return this.launchModal(); } else { - return dispatch(fetchMe()); + return dispatch(verifyCredentials(access_token)); } } @@ -106,12 +105,12 @@ class RegistrationForm extends ImmutablePureComponent { this.setState({ submissionLoading: true }); - dispatch(register(params.toJS())).then(() => { - this.postRegisterAction(); - }).catch(error => { - this.setState({ submissionLoading: false }); - this.refreshCaptcha(); - }); + dispatch(register(params.toJS())) + .then(this.postRegisterAction) + .catch(error => { + this.setState({ submissionLoading: false }); + this.refreshCaptcha(); + }); } onCaptchaClick = e => {