mirror of
https://github.com/hanzoai/desktop.git
synced 2026-10-30 14:58:42 +00:00
- Replace @babel/standalone with lightweight TypeScript CDN transpiler for artifacts - Gut PostHog analytics provider (return children passthrough) - Update IAM client ID to hanzo-app-client-id - Remove @vitejs/plugin-legacy, add libsodium-sumo resolve alias in vite config - Fix all 60+ mutation hooks: remove extraneous `undefined as never` arg from onSuccess - Trim unused deps: posthog-js, crypto-js, rxjs, react-scan, rehype-raw, katex, etc. - Add mise.toml, update package-lock.json
33 lines
1002 B
TypeScript
33 lines
1002 B
TypeScript
import { type McpServer } from '@hanzo_network/hanzo-message-ts/api/mcp-servers/types';
|
|
import {
|
|
useMutation,
|
|
type UseMutationOptions,
|
|
useQueryClient,
|
|
} from '@tanstack/react-query';
|
|
|
|
import { FunctionKeyV2 } from '../../constants';
|
|
import { type DeleteMcpServerInput } from './types';
|
|
import { deleteMcpServer } from './index';
|
|
|
|
export const useDeleteMcpServer = (
|
|
options?: UseMutationOptions<McpServer, Error, DeleteMcpServerInput>,
|
|
) => {
|
|
const queryClient = useQueryClient();
|
|
|
|
return useMutation({
|
|
mutationFn: async (input: DeleteMcpServerInput) => {
|
|
const { deleted_mcp_server } = await deleteMcpServer(input);
|
|
return deleted_mcp_server;
|
|
},
|
|
...options,
|
|
onSuccess: async (data, variables, context, mutationContext) => {
|
|
await queryClient.invalidateQueries({
|
|
queryKey: [FunctionKeyV2.GET_MCP_SERVERS],
|
|
});
|
|
if (options?.onSuccess) {
|
|
await options.onSuccess(data, variables, context, mutationContext);
|
|
}
|
|
},
|
|
});
|
|
};
|