Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-76676 || Button disabling during request #3078

Merged
merged 1 commit into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ export class RegistrationForm extends Component {
handleSubmit: PropTypes.func.isRequired,
autofill: PropTypes.func.isRequired,
email: PropTypes.string,
loading: PropTypes.bool,
};

static defaultProps = {
submitForm: () => {},
email: '',
loading: false,
};

componentDidMount = () => {
Expand All @@ -107,7 +109,7 @@ export class RegistrationForm extends Component {
});

render() {
const { handleSubmit, intl } = this.props;
const { handleSubmit, intl, loading } = this.props;
const { formatMessage } = intl;

return (
Expand Down Expand Up @@ -177,7 +179,7 @@ export class RegistrationForm extends Component {
</BigButton>
</div>
<div className={cx('button-register')}>
<BigButton type={'submit'} roundedCorners color={'organish'}>
<BigButton type={'submit'} roundedCorners color={'organish'} disabled={loading}>
<FormattedMessage id={'RegistrationForm.register'} defaultMessage={'Register'} />
</BigButton>
</div>
Expand Down
14 changes: 12 additions & 2 deletions app/src/pages/outside/registrationPage/registrationPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ const messages = defineMessages({
},
});

export const RegistrationPage = ({ tokenActive, tokenProvided, email, onRegistrationSubmit }) => {
export const RegistrationPage = ({
tokenActive,
tokenProvided,
email,
onRegistrationSubmit,
loading,
}) => {
const backgroundClasses = {
background: true,
failed: !tokenProvided || !tokenActive,
Expand All @@ -67,7 +73,7 @@ export const RegistrationPage = ({ tokenActive, tokenProvided, email, onRegistra
{tokenProvided && tokenActive ? (
<div>
<BlockHeader header={messages.welcome} hint={messages.registration} />
<RegistrationForm email={email} submitForm={onRegistrationSubmit} />
<RegistrationForm email={email} submitForm={onRegistrationSubmit} loading={loading} />
</div>
) : (
<TokenErrorSection tokenProvided={tokenProvided} />
Expand All @@ -82,12 +88,14 @@ RegistrationPage.propTypes = {
tokenProvided: PropTypes.bool,
email: PropTypes.string,
onRegistrationSubmit: PropTypes.func,
loading: PropTypes.bool,
};
RegistrationPage.defaultProps = {
tokenActive: false,
tokenProvided: false,
email: '',
onRegistrationSubmit: () => {},
loading: false,
};

const TokenErrorSection = ({ tokenProvided }) => (
Expand Down Expand Up @@ -125,7 +133,9 @@ const TokenErrorSection = ({ tokenProvided }) => (
);
TokenErrorSection.propTypes = {
tokenProvided: PropTypes.bool,
loading: PropTypes.bool,
};
TokenErrorSection.defaultProps = {
tokenProvided: false,
loading: false,
};