import React, { useState } from 'react';
import { FormattedMessage } from 'react-intl';
import { Formik, Form, Field } from 'formik';
import { post } from 'lib/web';
import Button from 'components/common/Button';
import FormLayout, {
FormButtons,
FormError,
FormMessage,
FormRow,
} from 'components/layout/FormLayout';
const initialValues = {
username: '',
password: '',
};
const validate = ({ user_id, username, password }) => {
const errors = {};
if (!username) {
errors.username = ;
}
if (!user_id && !password) {
errors.password = ;
}
return errors;
};
export default function AccountEditForm({ values, onSave, onClose }) {
const [message, setMessage] = useState();
const handleSubmit = async values => {
const response = await post(`/api/account`, values);
if (typeof response !== 'string') {
onSave();
} else {
setMessage(
response || (
),
);
}
};
return (
{() => (
)}
);
}