BOD-40 #comment Form fixed to use new form methods.
This commit is contained in:
@@ -16,57 +16,40 @@ const mapDispatchToProps = dispatch => ({
|
|||||||
export default connect(
|
export default connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(function ProfileMyComponent({
|
)(function ProfileMyComponent({ currentUser, updateUserDetails }) {
|
||||||
currentUser,
|
|
||||||
|
|
||||||
updateUserDetails
|
|
||||||
}) {
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
const { isFieldsTouched, resetFields } = form;
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const handleSubmit = e => {
|
const handleFinish = values => {
|
||||||
e.preventDefault();
|
updateUserDetails({
|
||||||
|
displayName: values.displayName,
|
||||||
form.validateFieldsAndScroll((err, values) => {
|
photoURL: values.photoURL
|
||||||
if (err) {
|
|
||||||
notification["error"]({
|
|
||||||
message: t("jobs.errors.validationtitle"),
|
|
||||||
description: t("jobs.errors.validation")
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (!err) {
|
|
||||||
console.log("values", values);
|
|
||||||
updateUserDetails({
|
|
||||||
displayName: values.displayname,
|
|
||||||
photoURL: values.photoURL
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{isFieldsTouched() ? <ResetForm resetFields={resetFields} /> : null}
|
<Form
|
||||||
|
onFinish={handleFinish}
|
||||||
<Form onSubmit={handleSubmit} autoComplete={"no"}>
|
autoComplete={"no"}
|
||||||
|
initialValues={currentUser}
|
||||||
|
>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={t("user.fields.displayname")}
|
label={t("user.fields.displayname")}
|
||||||
rules={[{ required: true }]}
|
rules={[
|
||||||
name="displayname"
|
{
|
||||||
|
required: true,
|
||||||
|
message: t("general.validation.required")
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
name="displayName"
|
||||||
>
|
>
|
||||||
<Input />)
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label={t("user.fields.photourl")} name="photoURL">
|
<Form.Item label={t("user.fields.photourl")} name="photoURL">
|
||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Button
|
<Button type="primary" key="submit" htmlType="submit">
|
||||||
type="primary"
|
|
||||||
key="submit"
|
|
||||||
htmlType="submit"
|
|
||||||
onClick={handleSubmit}
|
|
||||||
>
|
|
||||||
{t("user.actions.updateprofile")}
|
{t("user.actions.updateprofile")}
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
|
|||||||
Reference in New Issue
Block a user