Remove frontend hack for requesting persistent browser sessions, part iii (frontend) (#3053)

This commit is contained in:
Jonathan Dobson
2025-07-29 10:12:42 -04:00
committed by GitHub
parent 8ff1c5dfa2
commit 9c00cff362
6 changed files with 131 additions and 169 deletions

View File

@@ -0,0 +1,29 @@
import { getClient } from "@/api/AxiosClient";
import { DebugSessionApiResponse } from "@/api/types";
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
import { useQuery } from "@tanstack/react-query";
interface Opts {
workflowPermanentId?: string;
enabled?: boolean;
}
function useDebugSessionQuery({ workflowPermanentId, enabled }: Opts) {
const credentialGetter = useCredentialGetter();
return useQuery<DebugSessionApiResponse>({
queryKey: ["debugSession", workflowPermanentId],
queryFn: async () => {
const client = await getClient(credentialGetter, "sans-api-v1");
return client
.get(`/debug-session/${workflowPermanentId}`)
.then((response) => response.data);
},
enabled:
enabled !== undefined
? enabled && !!workflowPermanentId
: !!workflowPermanentId,
});
}
export { useDebugSessionQuery };