"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = require("react");
var _reactNativeCloudCa = require("react-native-cloud-ca");
const useCancelPendingRequest = () => {
  const [result, setResult] = (0, _react.useState)(null);
  const [error, setError] = (0, _react.useState)(null);
  const [isLoading, setIsLoading] = (0, _react.useState)(false);
  const cancelPendingRequestFunc = (0, _react.useCallback)(async params => {
    const {
      transactionID,
      request,
      hashAlgorithm
    } = params;
    try {
      setIsLoading(true);
      const response = await (0, _reactNativeCloudCa.cancelPendingRequest)({
        transactionID,
        request,
        hashAlgorithm
      });
      setResult(response);
    } catch (e) {
      setError(e);
    } finally {
      setIsLoading(false);
    }
  }, []);
  return [result, error, cancelPendingRequestFunc, isLoading];
};
var _default = useCancelPendingRequest;
exports.default = _default;
//# sourceMappingURL=useCancelPendingRequest.js.map