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(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(function ProfileMyComponent({
|
||||
currentUser,
|
||||
|
||||
updateUserDetails
|
||||
}) {
|
||||
const [form] = Form.useForm();
|
||||
const { isFieldsTouched, resetFields } = form;
|
||||
)(function ProfileMyComponent({ currentUser, updateUserDetails }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handleSubmit = e => {
|
||||
e.preventDefault();
|
||||
|
||||
form.validateFieldsAndScroll((err, values) => {
|
||||
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
|
||||
});
|
||||
}
|
||||
const handleFinish = values => {
|
||||
updateUserDetails({
|
||||
displayName: values.displayName,
|
||||
photoURL: values.photoURL
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
{isFieldsTouched() ? <ResetForm resetFields={resetFields} /> : null}
|
||||
|
||||
<Form onSubmit={handleSubmit} autoComplete={"no"}>
|
||||
<Form
|
||||
onFinish={handleFinish}
|
||||
autoComplete={"no"}
|
||||
initialValues={currentUser}
|
||||
>
|
||||
<Form.Item
|
||||
label={t("user.fields.displayname")}
|
||||
rules={[{ required: true }]}
|
||||
name="displayname"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required")
|
||||
}
|
||||
]}
|
||||
name="displayName"
|
||||
>
|
||||
<Input />)
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item label={t("user.fields.photourl")} name="photoURL">
|
||||
<Input />
|
||||
</Form.Item>
|
||||
|
||||
<Button
|
||||
type="primary"
|
||||
key="submit"
|
||||
htmlType="submit"
|
||||
onClick={handleSubmit}
|
||||
>
|
||||
<Button type="primary" key="submit" htmlType="submit">
|
||||
{t("user.actions.updateprofile")}
|
||||
</Button>
|
||||
</Form>
|
||||
|
||||
Reference in New Issue
Block a user