Created
November 18, 2025 21:28
-
-
Save alexmkio/be2c377abd2d40080763aff2cf7333b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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