import type { Actions } from 'easy-peasy'; import { useStoreActions } from 'easy-peasy'; import type { FormikHelpers } from 'formik'; import { useNavigate } from 'react-router-dom'; import tw from 'twin.macro'; import type { UpdateUserValues } from '@/api/admin/users'; import { createUser } from '@/api/admin/users'; import AdminContentBlock from '@/components/admin/AdminContentBlock'; import UserForm from '@/components/admin/users/UserForm'; import FlashMessageRender from '@/components/FlashMessageRender'; import type { ApplicationStore } from '@/state'; export default () => { const navigate = useNavigate(); const { clearFlashes, clearAndAddHttpError } = useStoreActions( (actions: Actions) => actions.flashes, ); const submit = (values: UpdateUserValues, { setSubmitting }: FormikHelpers) => { clearFlashes('user:create'); createUser(values) .then(user => navigate(`/admin/users/${user.id}`)) .catch(error => { console.error(error); clearAndAddHttpError({ key: 'user:create', error }); }) .then(() => setSubmitting(false)); }; return (

New User

Add a new user to the panel.

); };