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,4 @@
|
|||
import React, { useState } from 'react';
|
||||
import { useState } from 'react';
|
||||
import { faTrashAlt } from '@fortawesome/free-solid-svg-icons';
|
||||
import tw from 'twin.macro';
|
||||
import Icon from '@/components/elements/Icon';
|
||||
|
@ -16,8 +16,8 @@ interface Props {
|
|||
const DeleteAllocationButton = ({ allocation }: Props) => {
|
||||
const [confirm, setConfirm] = useState(false);
|
||||
|
||||
const uuid = ServerContext.useStoreState((state) => state.server.data!.uuid);
|
||||
const setServerFromState = ServerContext.useStoreActions((actions) => actions.server.setServerFromState);
|
||||
const uuid = ServerContext.useStoreState(state => state.server.data!.uuid);
|
||||
const setServerFromState = ServerContext.useStoreActions(actions => actions.server.setServerFromState);
|
||||
|
||||
const { mutate } = getServerAllocations();
|
||||
const { clearFlashes, clearAndAddHttpError } = useFlashKey('server:network');
|
||||
|
@ -25,10 +25,10 @@ const DeleteAllocationButton = ({ allocation }: Props) => {
|
|||
const deleteAllocation = () => {
|
||||
clearFlashes();
|
||||
|
||||
mutate((data) => data?.filter((a) => a.id !== allocation), false);
|
||||
setServerFromState((s) => ({ ...s, allocations: s.allocations.filter((a) => a.id !== allocation) }));
|
||||
mutate(data => data?.filter(a => a.id !== allocation), false);
|
||||
setServerFromState(s => ({ ...s, allocations: s.allocations.filter(a => a.id !== allocation) }));
|
||||
|
||||
deleteServerAllocation(uuid, allocation).catch((error) => {
|
||||
deleteServerAllocation(uuid, allocation).catch(error => {
|
||||
clearAndAddHttpError(error);
|
||||
mutate();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue