Download src/hooks/mutation/use-create-provider-connection.ts from SaylorTwift/openhands: direct link, hf CLI and curl.
- Browser
- Download file 777 Bytes
-
https://huggingface.co/SaylorTwift/openhands/resolve/main/src/hooks/mutation/use-create-provider-connection.ts
- Command line
-
hf download hf://SaylorTwift/openhands/src/hooks/mutation/use-create-provider-connection.ts
-
curl -L -o use-create-provider-connection.ts https://huggingface.co/SaylorTwift/openhands/resolve/main/src/hooks/mutation/use-create-provider-connection.ts
777 Bytes
| import { useMutation, useQueryClient } from "@tanstack/react-query"; | |
| import ProviderConnectionsService, { | |
| type CreateProviderConnectionRequest, | |
| } from "#/api/provider-connections-service/provider-connections-service.api"; | |
| import { PROVIDER_CONNECTIONS_QUERY_KEYS } from "#/hooks/query/query-keys"; | |
| export function useCreateProviderConnection() { | |
| const queryClient = useQueryClient(); | |
| return useMutation({ | |
| mutationFn: (request: CreateProviderConnectionRequest) => | |
| ProviderConnectionsService.create(request), | |
| onSuccess: async () => { | |
| await queryClient.invalidateQueries({ | |
| queryKey: PROVIDER_CONNECTIONS_QUERY_KEYS.all, | |
| }); | |
| }, | |
| // Consumers handle errors with try-catch and manual toasts. | |
| meta: { disableToast: true }, | |
| }); | |
| } | |