Merge remote-tracking branch 'origin/develop' into fe-basename
This commit is contained in:
commit
a9b757f6a5
3 changed files with 16 additions and 5 deletions
|
@ -33,9 +33,14 @@ const validLocale = locale => Object.keys(messages).includes(locale);
|
||||||
export const store = configureStore();
|
export const store = configureStore();
|
||||||
|
|
||||||
store.dispatch(preload());
|
store.dispatch(preload());
|
||||||
store.dispatch(fetchMe());
|
|
||||||
store.dispatch(fetchInstance());
|
store.dispatch(fetchMe())
|
||||||
store.dispatch(fetchSoapboxConfig());
|
.then(() => {
|
||||||
|
// Postpone for authenticated fetch
|
||||||
|
store.dispatch(fetchInstance());
|
||||||
|
store.dispatch(fetchSoapboxConfig());
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
const me = state.get('me');
|
const me = state.get('me');
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { injectIntl } from 'react-intl';
|
||||||
import LoginForm from './login_form';
|
import LoginForm from './login_form';
|
||||||
import OtpAuthForm from './otp_auth_form';
|
import OtpAuthForm from './otp_auth_form';
|
||||||
import { logIn, verifyCredentials, switchAccount } from 'soapbox/actions/auth';
|
import { logIn, verifyCredentials, switchAccount } from 'soapbox/actions/auth';
|
||||||
|
import { fetchInstance } from 'soapbox/actions/instance';
|
||||||
import { isStandalone } from 'soapbox/utils/state';
|
import { isStandalone } from 'soapbox/utils/state';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
|
@ -40,7 +41,9 @@ class LoginPage extends ImmutablePureComponent {
|
||||||
const { dispatch, intl, me } = this.props;
|
const { dispatch, intl, me } = this.props;
|
||||||
const { username, password } = this.getFormData(event.target);
|
const { username, password } = this.getFormData(event.target);
|
||||||
dispatch(logIn(intl, username, password)).then(({ access_token }) => {
|
dispatch(logIn(intl, username, password)).then(({ access_token }) => {
|
||||||
return dispatch(verifyCredentials(access_token));
|
return dispatch(verifyCredentials(access_token))
|
||||||
|
// Refetch the instance for authenticated fetch
|
||||||
|
.then(() => dispatch(fetchInstance()));
|
||||||
}).then(account => {
|
}).then(account => {
|
||||||
this.setState({ shouldRedirect: true });
|
this.setState({ shouldRedirect: true });
|
||||||
if (typeof me === 'string') {
|
if (typeof me === 'string') {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import SoapboxPropTypes from 'soapbox/utils/soapbox_prop_types';
|
||||||
import { defineMessages, injectIntl } from 'react-intl';
|
import { defineMessages, injectIntl } from 'react-intl';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { logIn, verifyCredentials } from 'soapbox/actions/auth';
|
import { logIn, verifyCredentials } from 'soapbox/actions/auth';
|
||||||
|
import { fetchInstance } from 'soapbox/actions/instance';
|
||||||
import OtpAuthForm from 'soapbox/features/auth_login/components/otp_auth_form';
|
import OtpAuthForm from 'soapbox/features/auth_login/components/otp_auth_form';
|
||||||
import IconButton from 'soapbox/components/icon_button';
|
import IconButton from 'soapbox/components/icon_button';
|
||||||
|
|
||||||
|
@ -55,7 +56,9 @@ class Header extends ImmutablePureComponent {
|
||||||
const { dispatch, intl } = this.props;
|
const { dispatch, intl } = this.props;
|
||||||
const { username, password } = this.getFormData(event.target);
|
const { username, password } = this.getFormData(event.target);
|
||||||
dispatch(logIn(intl, username, password)).then(({ access_token }) => {
|
dispatch(logIn(intl, username, password)).then(({ access_token }) => {
|
||||||
return dispatch(verifyCredentials(access_token));
|
return dispatch(verifyCredentials(access_token))
|
||||||
|
// Refetch the instance for authenticated fetch
|
||||||
|
.then(() => dispatch(fetchInstance()));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
if (error.response.data.error === 'mfa_required') {
|
if (error.response.data.error === 'mfa_required') {
|
||||||
this.setState({ mfa_auth_needed: true, mfa_token: error.response.data.mfa_token });
|
this.setState({ mfa_auth_needed: true, mfa_token: error.response.data.mfa_token });
|
||||||
|
|
Loading…
Reference in a new issue