UNPKG

react-hooks-toolbox

Version:

React hooks toolbox

19 lines (16 loc) 769 B
import { getDymoUrl, dymoAxios } from "../utils/dymo"; import { useAxiosPost } from "../useAxiosPost"; export function useDymoOpenLabel(statusDymoService, labelXML) { var port = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 41951; var _useAxiosPost = useAxiosPost({ url: getDymoUrl("RenderLabel", port), options: { data: "labelXml=" + encodeURIComponent(labelXML) + "&renderParamsXml=&printerName=" }, axiosInstance: dymoAxios, onlyDispatchIf: statusDymoService === "success", delay: 500 }), status = _useAxiosPost.status, response = _useAxiosPost.response, error = _useAxiosPost.error; return { label: response, statusOpenLabel: status, errorOpenLabel: error }; }