mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 09:46:16 +01:00
move loading state for add user back to the submit button
This change is necessary, because the old loading behaviour forces the form to rerender, which in turn causes a lost of the input. Now the loading state is back to the submit button.
This commit is contained in:
@@ -9,6 +9,7 @@ import * as validator from "./userValidation";
|
|||||||
type Props = {
|
type Props = {
|
||||||
submitForm: User => void,
|
submitForm: User => void,
|
||||||
user?: User,
|
user?: User,
|
||||||
|
loading?: boolean,
|
||||||
t: string => string
|
t: string => string
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -80,7 +81,7 @@ class UserForm extends React.Component<Props, State> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { t } = this.props;
|
const { loading, t } = this.props;
|
||||||
const user = this.state.user;
|
const user = this.state.user;
|
||||||
|
|
||||||
let nameField = null;
|
let nameField = null;
|
||||||
@@ -140,6 +141,7 @@ class UserForm extends React.Component<Props, State> {
|
|||||||
/>
|
/>
|
||||||
<SubmitButton
|
<SubmitButton
|
||||||
disabled={!this.isValid()}
|
disabled={!this.isValid()}
|
||||||
|
loading={loading}
|
||||||
label={t("user-form.submit")}
|
label={t("user-form.submit")}
|
||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -38,10 +38,12 @@ class AddUser extends React.Component<Props> {
|
|||||||
<Page
|
<Page
|
||||||
title={t("add-user.title")}
|
title={t("add-user.title")}
|
||||||
subtitle={t("add-user.subtitle")}
|
subtitle={t("add-user.subtitle")}
|
||||||
loading={loading}
|
|
||||||
error={error}
|
error={error}
|
||||||
>
|
>
|
||||||
<UserForm submitForm={user => this.createUser(user)} />
|
<UserForm
|
||||||
|
submitForm={user => this.createUser(user)}
|
||||||
|
loading={loading}
|
||||||
|
/>
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user