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

Create User

Add a new user to the panel.

); };