Skip to content

Instantly share code, notes, and snippets.

@alexmkio
Created November 18, 2025 21:28
Show Gist options
  • Select an option

  • Save alexmkio/be2c377abd2d40080763aff2cf7333b4 to your computer and use it in GitHub Desktop.

Select an option

Save alexmkio/be2c377abd2d40080763aff2cf7333b4 to your computer and use it in GitHub Desktop.
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { AddClientNoteRequestModel } from '@generated/api/models/AddClientNoteRequestModel';
import { ClientNoteResponseModelPaginatedList } from '@generated/api/models/ClientNoteResponseModelPaginatedList';
import { api } from '@utils/axios';
export const useCreateNote = (clientId: string) => {
const queryClient = useQueryClient();
return useMutation(
(value: AddClientNoteRequestModel) =>
api.post<ClientNoteResponseModelPaginatedList>(
`clients/${clientId}/notes`,
value,
),
{
onSuccess: () => {
queryClient.invalidateQueries(['client', clientId, 'notes']);
},
},
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment