MCPcopy Create free account
hub / github.com/MagicCube/agentara / useSessionDelete

Function useSessionDelete

web/src/lib/api/hooks.ts:29–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27 * Deletes a session by ID.
28 */
29export 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.

Callers 1

RecentsSidebarGroupFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected