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
37 lines
938 B
TypeScript
37 lines
938 B
TypeScript
import {
|
|
useMutation,
|
|
type UseMutationOptions,
|
|
useQueryClient,
|
|
} from '@tanstack/react-query';
|
|
|
|
import { FunctionKeyV2 } from '../../constants';
|
|
import { type APIError } from '../../types';
|
|
import {
|
|
type UpdateRecurringTaskInput,
|
|
type UpdateRecurringTaskOutput,
|
|
} from './types';
|
|
import { updateRecurringTask } from './index';
|
|
|
|
type Options = UseMutationOptions<
|
|
UpdateRecurringTaskOutput,
|
|
APIError,
|
|
UpdateRecurringTaskInput
|
|
>;
|
|
|
|
export const useUpdateRecurringTask = (options?: Options) => {
|
|
const queryClient = useQueryClient();
|
|
return useMutation({
|
|
mutationFn: updateRecurringTask,
|
|
...options,
|
|
onSuccess: async (response, variables, context, mutationContext) => {
|
|
await queryClient.invalidateQueries({
|
|
queryKey: [FunctionKeyV2.GET_RECURRING_TASKS],
|
|
});
|
|
|
|
if (options?.onSuccess) {
|
|
options.onSuccess(response, variables, context, mutationContext);
|
|
}
|
|
},
|
|
});
|
|
};
|