// runBlocks.js
import axios from 'axios';

/**
 * Runs bulk endpoint requests.
 * @param {string} endpoint - The API endpoint for sending bulk requests.
 * @param {Array} bulkRequests - An array of requests to be sent in bulk.
 * @param {function} onSuccess - Callback function to handle success.
 * @param {function} onError - Callback function to handle error.
 */
export const runBlocks = async (endpoint, bulkRequests, onSuccess, onError) => {
    try {
        const response = await axios.post(endpoint, bulkRequests);
        onSuccess(response.data);
    } catch (error) {
        console.error("Error running bulk requests:", error);
        onError(error);
    }
};
