const axios = require('../../axios');

/**
 * @param {string} host
 * @param {string} productId
 * @param {Record<string, any>} data
 * @param {string} token
 * @returns {Promise<*>}
 */
function updateProduct(host, productId, data, token) {
  return axios.patch(`https://api.${host}/v2/products/${productId}`, data, {
    headers: {
      Authorization: `Bearer ${token}`,
      'Content-Type': 'application/json',
    },
  });
}

module.exports = updateProduct;
