All files / src/hooks/payment-forms usePublicSeating.ts

100% Statements 3/3
66.66% Branches 2/3
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19          46x       1644x     22x            
import { useQuery } from "react-query";
import { customInstance } from "@services/api";
import type { SeatingConfig } from "@sections/PayBuilder/types";
 
// Public GET /products/{product_id}/seating → { assignSeating, rows, takenSeats }
export const usePublicSeating = (
  productId: string | number,
  enabled = true,
) =>
  useQuery<SeatingConfig>(
    ["public-seating", productId],
    () =>
      customInstance({
        url: `products/${productId}/seating`,
        method: "GET",
      }),
    { enabled: Boolean(productId) && enabled, refetchOnWindowFocus: false },
  );