LoginForm: properly convey "isLoading" state
This commit is contained in:
parent
633d453edf
commit
68a43d2df3
|
@ -20,17 +20,18 @@ class LoginPage extends ImmutablePureComponent {
|
|||
this.handleSubmit = this.handleSubmit.bind(this);
|
||||
}
|
||||
|
||||
state = {
|
||||
isLoading: false,
|
||||
mfa_auth_needed: false,
|
||||
mfa_token: '',
|
||||
}
|
||||
|
||||
getFormData = (form) => {
|
||||
return Object.fromEntries(
|
||||
Array.from(form).map(i => [i.name, i.value])
|
||||
);
|
||||
}
|
||||
|
||||
state = {
|
||||
mfa_auth_needed: false,
|
||||
mfa_token: '',
|
||||
}
|
||||
|
||||
handleSubmit = (event) => {
|
||||
const { dispatch } = this.props;
|
||||
const { username, password } = this.getFormData(event.target);
|
||||
|
@ -47,8 +48,8 @@ class LoginPage extends ImmutablePureComponent {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { me, isLoading } = this.props;
|
||||
const { mfa_auth_needed, mfa_token } = this.state;
|
||||
const { me } = this.props;
|
||||
const { isLoading, mfa_auth_needed, mfa_token } = this.state;
|
||||
if (me) return <Redirect to='/' />;
|
||||
|
||||
if (mfa_auth_needed) return <OtpAuthForm mfa_token={mfa_token} />;
|
||||
|
|
|
@ -36,6 +36,12 @@ class Header extends ImmutablePureComponent {
|
|||
this.handleSubmit = this.handleSubmit.bind(this);
|
||||
}
|
||||
|
||||
state = {
|
||||
isLoading: false,
|
||||
mfa_auth_needed: false,
|
||||
mfa_token: '',
|
||||
}
|
||||
|
||||
getFormData = (form) => {
|
||||
return Object.fromEntries(
|
||||
Array.from(form).map(i => [i.name, i.value])
|
||||
|
@ -71,14 +77,9 @@ class Header extends ImmutablePureComponent {
|
|||
intl: PropTypes.object.isRequired,
|
||||
}
|
||||
|
||||
state = {
|
||||
mfa_auth_needed: false,
|
||||
mfa_token: '',
|
||||
}
|
||||
|
||||
render() {
|
||||
const { me, instance, isLoading, intl } = this.props;
|
||||
const { mfa_auth_needed, mfa_token } = this.state;
|
||||
const { me, instance, intl } = this.props;
|
||||
const { isLoading, mfa_auth_needed, mfa_token } = this.state;
|
||||
|
||||
return (
|
||||
<nav className='header'>
|
||||
|
|
Loading…
Reference in New Issue