Apply new eslint rules; default to prettier for styling
This commit is contained in:
parent
f22cce8881
commit
dc84af9937
218 changed files with 3876 additions and 3564 deletions
|
@ -14,10 +14,10 @@ interface Props {
|
|||
}
|
||||
|
||||
const DeleteAllocationButton = ({ allocation }: Props) => {
|
||||
const [ confirm, setConfirm ] = useState(false);
|
||||
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,14 +25,13 @@ 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 => {
|
||||
clearAndAddHttpError(error);
|
||||
mutate();
|
||||
});
|
||||
deleteServerAllocation(uuid, allocation).catch((error) => {
|
||||
clearAndAddHttpError(error);
|
||||
mutate();
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -53,7 +52,7 @@ const DeleteAllocationButton = ({ allocation }: Props) => {
|
|||
type={'button'}
|
||||
onClick={() => setConfirm(true)}
|
||||
>
|
||||
<Icon icon={faTrashAlt} css={tw`w-3 h-auto`}/>
|
||||
<Icon icon={faTrashAlt} css={tw`w-3 h-auto`} />
|
||||
</Button.Danger>
|
||||
</>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue