import {useQuery} from "@tanstack/react-query";
import {ShippingWarehouseService} from "../../../../client";

const useShippingWarehousesList = () => {
    const {isPending, error, data, refetch} = useQuery({
        queryKey: ['getAllShippingWarehouses'],
        queryFn: ShippingWarehouseService.getAllShippingWarehouses
    });
    const shippingWarehouses = isPending || error || !data ? [] : data.shippingWarehouses;

    return {shippingWarehouses, refetch}
}
export default useShippingWarehousesList;