Merge remote-tracking branch 'origin/develop' into fe-basename

build-json
Alex Gleason 2021-09-03 11:44:02 -05:00
commit a9b757f6a5
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
3 zmienionych plików z 16 dodań i 5 usunięć

Wyświetl plik

@ -33,9 +33,14 @@ const validLocale = locale => Object.keys(messages).includes(locale);
export const store = configureStore();
store.dispatch(preload());
store.dispatch(fetchMe());
store.dispatch(fetchInstance());
store.dispatch(fetchSoapboxConfig());
store.dispatch(fetchMe())
.then(() => {
// Postpone for authenticated fetch
store.dispatch(fetchInstance());
store.dispatch(fetchSoapboxConfig());
})
.catch(() => {});
const mapStateToProps = (state) => {
const me = state.get('me');

Wyświetl plik

@ -6,6 +6,7 @@ import { injectIntl } from 'react-intl';
import LoginForm from './login_form';
import OtpAuthForm from './otp_auth_form';
import { logIn, verifyCredentials, switchAccount } from 'soapbox/actions/auth';
import { fetchInstance } from 'soapbox/actions/instance';
import { isStandalone } from 'soapbox/utils/state';
const mapStateToProps = state => ({
@ -40,7 +41,9 @@ class LoginPage extends ImmutablePureComponent {
const { dispatch, intl, me } = this.props;
const { username, password } = this.getFormData(event.target);
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 => {
this.setState({ shouldRedirect: true });
if (typeof me === 'string') {

Wyświetl plik

@ -9,6 +9,7 @@ import SoapboxPropTypes from 'soapbox/utils/soapbox_prop_types';
import { defineMessages, injectIntl } from 'react-intl';
import PropTypes from 'prop-types';
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 IconButton from 'soapbox/components/icon_button';
@ -55,7 +56,9 @@ class Header extends ImmutablePureComponent {
const { dispatch, intl } = this.props;
const { username, password } = this.getFormData(event.target);
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 => {
if (error.response.data.error === 'mfa_required') {
this.setState({ mfa_auth_needed: true, mfa_token: error.response.data.mfa_token });