aboutsummaryrefslogtreecommitdiff
path: root/src/components/hooks/queries/useWebsiteSessionQuery.ts
blob: 21e949114a9f2d18685e7760c4722267f7dbc51f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { useApi } from '../useApi';

export function useWebsiteSessionQuery(websiteId: string, sessionId: string) {
  const { get, useQuery } = useApi();

  return useQuery({
    queryKey: ['session', { websiteId, sessionId }],
    queryFn: () => {
      return get(`/websites/${websiteId}/sessions/${sessionId}`);
    },
    enabled: Boolean(websiteId && sessionId),
  });
}