React 18 and Vite (#4510)
This commit is contained in:
parent
1bb1b13f6d
commit
21613fa602
244 changed files with 4547 additions and 8933 deletions
|
@ -1,4 +1,3 @@
|
|||
import React from 'react';
|
||||
import { ServerContext } from '@/state/server';
|
||||
import TitledGreyBox from '@/components/elements/TitledGreyBox';
|
||||
import { Field as FormikField, Form, Formik, FormikHelpers, useFormikContext } from 'formik';
|
||||
|
@ -43,15 +42,15 @@ const RenameServerBox = () => {
|
|||
};
|
||||
|
||||
export default () => {
|
||||
const server = ServerContext.useStoreState((state) => state.server.data!);
|
||||
const setServer = ServerContext.useStoreActions((actions) => actions.server.setServer);
|
||||
const server = ServerContext.useStoreState(state => state.server.data!);
|
||||
const setServer = ServerContext.useStoreActions(actions => actions.server.setServer);
|
||||
const { addError, clearFlashes } = useStoreActions((actions: Actions<ApplicationStore>) => actions.flashes);
|
||||
|
||||
const submit = ({ name, description }: Values, { setSubmitting }: FormikHelpers<Values>) => {
|
||||
clearFlashes('settings');
|
||||
renameServer(server.uuid, name, description)
|
||||
.then(() => setServer({ ...server, name, description }))
|
||||
.catch((error) => {
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
addError({ key: 'settings', message: httpErrorToHuman(error) });
|
||||
})
|
||||
|
@ -63,7 +62,7 @@ export default () => {
|
|||
onSubmit={submit}
|
||||
initialValues={{
|
||||
name: server.name,
|
||||
description: server.description,
|
||||
description: server.description ?? '',
|
||||
}}
|
||||
validationSchema={object().shape({
|
||||
name: string().required().min(1),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue