AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { platformHooks } from '@/hooks/platform-hooks';
import { apiKeyApi } from '../api/api-key-api';
export const apiKeyKeys = {
all: ['api-keys'] as const,
};
export const apiKeyQueries = {
useApiKeys: () => {
const { platform } = platformHooks.useCurrentPlatform();
return useQuery({
queryKey: apiKeyKeys.all,
gcTime: 0,
staleTime: 0,
queryFn: () => apiKeyApi.list(),
enabled: platform.plan.apiKeysEnabled,
});
},
};
export const apiKeyMutations = {
useCreateApiKey: ({ onSuccess }: { onSuccess: () => void }) => {
return useMutation({
mutationFn: (request: { displayName: string }) =>
apiKeyApi.create(request),
onSuccess,
});
},
useDeleteApiKey: () => {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (keyId: string) => apiKeyApi.delete(keyId),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: apiKeyKeys.all });
},
});
},
};