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 createDatabase from '@/api/admin/databases/createDatabase'; import AdminContentBlock from '@/components/admin/AdminContentBlock'; import { InformationContainer, Values } from '@/components/admin/databases/DatabaseEditContainer'; import FlashMessageRender from '@/components/FlashMessageRender'; import { ApplicationStore } from '@/state'; export default () => { const navigate = useNavigate(); const { clearFlashes, clearAndAddHttpError } = useStoreActions( (actions: Actions) => actions.flashes, ); const submit = ({ name, host, port, username, password }: Values, { setSubmitting }: FormikHelpers) => { clearFlashes('database:create'); createDatabase(name, host, port, username, password) .then(database => navigate(`/admin/databases/${database.id}`)) .catch(error => { console.error(error); clearAndAddHttpError({ key: 'database:create', error }); }) .then(() => setSubmitting(false)); }; return (

New Database Host

Add a new database host to the panel.

); };