import React from 'react'; import tw from 'twin.macro'; import AdminContentBlock from '@/components/admin/AdminContentBlock'; import FlashMessageRender from '@/components/FlashMessageRender'; import MountForm from '@/components/admin/mounts/MountForm'; import { FormikHelpers } from 'formik'; import { useHistory } from 'react-router-dom'; import { Actions, useStoreActions } from 'easy-peasy'; import { ApplicationStore } from '@/state'; import createMount from '@/api/admin/mounts/createMount'; export default () => { const history = useHistory(); const { clearFlashes, clearAndAddHttpError } = useStoreActions((actions: Actions) => actions.flashes); const submit = ({ name, description, source, target, readOnly, userMountable }: any, { setSubmitting }: FormikHelpers) => { clearFlashes('mount:create'); createMount(name, description, source, target, readOnly === '1', userMountable === '1') .then(mount => history.push(`/admin/mounts/${mount.id}`)) .catch(error => { console.error(error); clearAndAddHttpError({ key: 'mount:create', error }); }) .then(() => setSubmitting(false)); }; return (

Create Mount

Add a new mount to the panel.

); };