mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-07-02 02:51:40 +02:00
24e578db5f
Co-authored-by: Gregory Schier <gschier1990@gmail.com>
19 lines
640 B
TypeScript
19 lines
640 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import type { HttpResponse } from "@yaakapp-internal/models";
|
|
import type { SseSummary } from "@yaakapp-internal/sse";
|
|
import { getResponseBodySseSummary } from "../lib/responseBody";
|
|
|
|
export function useResponseBodySseSummary(response: HttpResponse, resultKeyPath: string | null) {
|
|
return useQuery<SseSummary>({
|
|
enabled: resultKeyPath != null,
|
|
queryKey: [
|
|
"response-body-sse-summary",
|
|
response.id,
|
|
response.updatedAt,
|
|
response.contentLength,
|
|
resultKeyPath,
|
|
],
|
|
queryFn: () => getResponseBodySseSummary(response, resultKeyPath ?? ""),
|
|
});
|
|
}
|