import { Dropdown, Item, Form, FormRow, FormButtons, FormInput, TextField, PasswordField, SubmitButton, Button, } from 'react-basics'; import useApi from 'hooks/useApi'; import { ROLES } from 'lib/constants'; import useMessages from 'hooks/useMessages'; export function UserAddForm({ onSave, onClose }) { const { post, useMutation } = useApi(); const { mutate, error, isLoading } = useMutation(data => post(`/users`, data)); const { formatMessage, labels } = useMessages(); const handleSubmit = async data => { mutate(data, { onSuccess: async () => { onSave(data); onClose(); }, }); }; const renderValue = value => { if (value === ROLES.user) { return formatMessage(labels.user); } if (value === ROLES.admin) { return formatMessage(labels.admin); } if (value === ROLES.viewOnly) { return formatMessage(labels.viewOnly); } }; return (
{formatMessage(labels.viewOnly)} {formatMessage(labels.user)} {formatMessage(labels.admin)} {formatMessage(labels.save)}
); } export default UserAddForm;