()
| 27 | * Deletes a session by ID. |
| 28 | */ |
| 29 | export function useSessionDelete() { |
| 30 | const queryClient = useQueryClient(); |
| 31 | return useMutation({ |
| 32 | mutationFn: async (sessionId: string) => { |
| 33 | const res = await api.sessions[":id"].$delete({ |
| 34 | param: { id: sessionId }, |
| 35 | }); |
| 36 | if (!res.ok) { |
| 37 | const text = await res.text(); |
| 38 | throw new Error(`Delete failed: ${res.status} ${text}`); |
| 39 | } |
| 40 | }, |
| 41 | onSuccess: () => { |
| 42 | void queryClient.invalidateQueries({ queryKey: ["sessions"] }); |
| 43 | }, |
| 44 | }); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Fetches the message history for a given session. |
no outgoing calls
no test coverage detected