2026-03-23 18:19:50 +01:00
|
|
|
import { useQuery } from '@tanstack/react-query';
|
|
|
|
|
import { api } from '../client';
|
|
|
|
|
|
2026-04-09 16:01:50 +02:00
|
|
|
export function useCorrelationChain(correlationId: string | null, environment?: string) {
|
2026-03-23 18:19:50 +01:00
|
|
|
return useQuery({
|
2026-04-09 16:01:50 +02:00
|
|
|
queryKey: ['correlation-chain', correlationId, environment],
|
2026-03-23 18:19:50 +01:00
|
|
|
queryFn: async () => {
|
|
|
|
|
const { data } = await api.POST('/search/executions', {
|
|
|
|
|
body: {
|
|
|
|
|
correlationId: correlationId!,
|
2026-04-09 16:01:50 +02:00
|
|
|
environment,
|
2026-03-23 18:19:50 +01:00
|
|
|
limit: 20,
|
|
|
|
|
sortField: 'startTime',
|
|
|
|
|
sortDir: 'asc',
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
return data;
|
|
|
|
|
},
|
|
|
|
|
enabled: !!correlationId,
|
|
|
|
|
});
|
|
|
|
|
}
|