feat(web): add chat comments atoms and hooks

This commit is contained in:
CREDO23 2026-01-15 19:57:25 +02:00
parent 33670aceb5
commit 134f9577b9
3 changed files with 163 additions and 0 deletions

View file

@ -0,0 +1,19 @@
import { useQuery } from "@tanstack/react-query";
import { chatCommentsApiService } from "@/lib/apis/chat-comments-api.service";
import { cacheKeys } from "@/lib/query-client/cache-keys";
interface UseCommentsOptions {
messageId: number;
enabled?: boolean;
}
export function useComments({ messageId, enabled = true }: UseCommentsOptions) {
return useQuery({
queryKey: cacheKeys.comments.byMessage(messageId),
queryFn: async () => {
return chatCommentsApiService.getComments({ message_id: messageId });
},
enabled: enabled && !!messageId,
});
}