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 AdminContentBlock from '@/components/admin/AdminContentBlock'; import FlashMessageRender from '@/components/FlashMessageRender'; import MountForm from '@/components/admin/mounts/MountForm'; import createMount from '@/api/admin/mounts/createMount'; import type { ApplicationStore } from '@/state'; export default () => { const navigate = useNavigate(); 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 => navigate(`/admin/mounts/${mount.id}`)) .catch(error => { console.error(error); clearAndAddHttpError({ key: 'mount:create', error }); }) .then(() => setSubmitting(false)); }; return (

New Mount

Add a new mount to the panel.

); };