import { errorHandler, getAuthHeaderOptions, fetchRespHandler, } from "../utils/http"; const API_ENDPOINT = process.env.REACT_APP_CERT_SERVICE_URL; const certificatesAPI = { create: async (data, token) => fetch(`${API_ENDPOINT}/create`, { method: "POST", headers: Object.assign( { "Content-Type": "application/json" }, getAuthHeaderOptions(token) ), body: JSON.stringify(data), }) .then(fetchRespHandler) .catch(errorHandler), createAftersales: async (data, token) => fetch(`${API_ENDPOINT}/create-aftersales`, { method: "POST", headers: Object.assign( { "Content-Type": "application/json" }, getAuthHeaderOptions(token) ), body: JSON.stringify(data), }) .then(fetchRespHandler) .catch(errorHandler), }; export default certificatesAPI;