mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 08:34:52 -07:00
connect reset password to login view (#4489)
This commit is contained in:
parent
811ee54c76
commit
1f15445c69
31 changed files with 893 additions and 445 deletions
|
|
@ -10,9 +10,29 @@ import { InputField } from 'components';
|
|||
|
||||
import './KnownHostForm.css';
|
||||
|
||||
function KnownHostForm({ host, onRemove, onSubmit }) {
|
||||
const KnownHostForm = ({ host, onRemove, onSubmit }) => {
|
||||
const [confirmDelete, setConfirmDelete] = useState(false);
|
||||
|
||||
const validate = values => {
|
||||
const errors: any = {};
|
||||
|
||||
if (!values.name) {
|
||||
errors.name = 'Required'
|
||||
}
|
||||
|
||||
if (!values.host) {
|
||||
errors.host = 'Required'
|
||||
}
|
||||
|
||||
if (!values.port) {
|
||||
errors.port = 'Required'
|
||||
}
|
||||
|
||||
if (Object.keys(errors).length) {
|
||||
return errors;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Form
|
||||
initialValues={{
|
||||
|
|
@ -22,25 +42,7 @@ function KnownHostForm({ host, onRemove, onSubmit }) {
|
|||
port: host?.port,
|
||||
}}
|
||||
onSubmit={onSubmit}
|
||||
validate={values => {
|
||||
const errors: any = {};
|
||||
|
||||
if (!values.name) {
|
||||
errors.name = 'Required'
|
||||
}
|
||||
|
||||
if (!values.host) {
|
||||
errors.host = 'Required'
|
||||
}
|
||||
|
||||
if (!values.port) {
|
||||
errors.port = 'Required'
|
||||
}
|
||||
|
||||
if (Object.keys(errors).length) {
|
||||
return errors;
|
||||
}
|
||||
}}
|
||||
validate={validate}
|
||||
>
|
||||
{({ handleSubmit }) => (
|
||||
<form className="KnownHostForm" onSubmit={handleSubmit}>
|
||||
|
|
@ -74,7 +76,7 @@ function KnownHostForm({ host, onRemove, onSubmit }) {
|
|||
) }
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const mapStateToProps = () => ({
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue