Ivan - Add input disabled when loading [skip ci]
This commit is contained in:
parent
dae244bee2
commit
39e7d61933
|
@ -27,7 +27,8 @@ let MainHomePageLoginWidget = React.createClass({
|
||||||
loginFormErrors: {},
|
loginFormErrors: {},
|
||||||
recoverFormErrors: {},
|
recoverFormErrors: {},
|
||||||
recoverSent: false,
|
recoverSent: false,
|
||||||
loading: false
|
loadingLogin: false,
|
||||||
|
loadingRecover: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -95,7 +96,7 @@ let MainHomePageLoginWidget = React.createClass({
|
||||||
|
|
||||||
getLoginFormProps() {
|
getLoginFormProps() {
|
||||||
return {
|
return {
|
||||||
loading: this.state.loading,
|
loading: this.state.loadingLogin,
|
||||||
className: 'login-widget__form',
|
className: 'login-widget__form',
|
||||||
ref: 'loginForm',
|
ref: 'loginForm',
|
||||||
onSubmit:this.handleLoginFormSubmit,
|
onSubmit:this.handleLoginFormSubmit,
|
||||||
|
@ -106,7 +107,7 @@ let MainHomePageLoginWidget = React.createClass({
|
||||||
|
|
||||||
getRecoverFormProps() {
|
getRecoverFormProps() {
|
||||||
return {
|
return {
|
||||||
loading: this.state.loading,
|
loading: this.state.loadingRecover,
|
||||||
className: 'login-widget__form',
|
className: 'login-widget__form',
|
||||||
ref: 'recoverForm',
|
ref: 'recoverForm',
|
||||||
onSubmit:this.handleForgotPasswordSubmit,
|
onSubmit:this.handleForgotPasswordSubmit,
|
||||||
|
@ -119,7 +120,7 @@ let MainHomePageLoginWidget = React.createClass({
|
||||||
UserActions.login(formState);
|
UserActions.login(formState);
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: true
|
loadingLogin: true
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -127,7 +128,7 @@ let MainHomePageLoginWidget = React.createClass({
|
||||||
UserActions.sendRecover(formState);
|
UserActions.sendRecover(formState);
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: true
|
loadingRecover: true
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -159,7 +160,7 @@ let MainHomePageLoginWidget = React.createClass({
|
||||||
onUserStoreChanged(event) {
|
onUserStoreChanged(event) {
|
||||||
if (event === 'LOGIN_FAIL') {
|
if (event === 'LOGIN_FAIL') {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loadingLogin: false,
|
||||||
loginFormErrors: {
|
loginFormErrors: {
|
||||||
password: i18n('ERROR_PASSWORD')
|
password: i18n('ERROR_PASSWORD')
|
||||||
}
|
}
|
||||||
|
@ -170,7 +171,7 @@ let MainHomePageLoginWidget = React.createClass({
|
||||||
|
|
||||||
if (event === 'SEND_RECOVER_FAIL') {
|
if (event === 'SEND_RECOVER_FAIL') {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loadingRecover: false,
|
||||||
recoverFormErrors: {
|
recoverFormErrors: {
|
||||||
email: i18n('EMAIL_NOT_EXIST')
|
email: i18n('EMAIL_NOT_EXIST')
|
||||||
}
|
}
|
||||||
|
@ -182,7 +183,7 @@ let MainHomePageLoginWidget = React.createClass({
|
||||||
|
|
||||||
if (event === 'SEND_RECOVER_SUCCESS') {
|
if (event === 'SEND_RECOVER_SUCCESS') {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loadingRecover: false,
|
||||||
recoverSent: true
|
recoverSent: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,10 @@ const Icon = require('core-components/icon');
|
||||||
|
|
||||||
const Input = React.createClass({
|
const Input = React.createClass({
|
||||||
|
|
||||||
|
contextTypes: {
|
||||||
|
loading: React.PropTypes.bool
|
||||||
|
},
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
value: React.PropTypes.string,
|
value: React.PropTypes.string,
|
||||||
validation: React.PropTypes.string,
|
validation: React.PropTypes.string,
|
||||||
|
@ -60,6 +64,7 @@ const Input = React.createClass({
|
||||||
props['aria-required'] = this.props.required;
|
props['aria-required'] = this.props.required;
|
||||||
props.type = (this.props.password) ? 'password' : 'text';
|
props.type = (this.props.password) ? 'password' : 'text';
|
||||||
props.ref = 'nativeInput';
|
props.ref = 'nativeInput';
|
||||||
|
props.disabled = this.context.loading;
|
||||||
|
|
||||||
delete props.required;
|
delete props.required;
|
||||||
delete props.validation;
|
delete props.validation;
|
||||||
|
|
Loading…
Reference in New Issue