import _Upload from "antd/es/upload";
import _Button from "antd/es/button";
import * as React from 'react';
import { useEffect, useState } from 'react';
var RcFileUpload = function RcFileUpload(props) {
  // const [DocUnid, setDocUnid] = useState('')
  // const [Processid, setProcessid] = useState('')
  // const [NodeName, setNodeName] = useState('')
  var _useState = useState(''),
    baseURL = _useState[0],
    setBaseURL = _useState[1];
  var _useState2 = useState(''),
    identitytoken = _useState2[0],
    setIdentitytoken = _useState2[1];
  var onChange = props.onChange,
    disabled = props.disabled,
    uploadUrl = props.uploadUrl,
    fileName = props.fileName,
    maxCount = props.maxCount,
    data = props.data;
  useEffect(function () {
    setBaseURL(getApiPath());
    var token = localStorage.getItem('identitytoken');
    token && setIdentitytoken(token);
  }, []);
  var getApiPath = function getApiPath() {
    var origin = window.location.origin;
    if (origin.includes('localhost') || origin.includes('127.0.0.1')) {
      return 'http://120.77.47.73:8080';
    } else {
      return origin;
    }
  };
  return /*#__PURE__*/React.createElement(_Upload, {
    action: uploadUrl || baseURL + "/restcloud/rest/bpm/form/import",
    onChange: onChange,
    name: fileName,
    headers: {
      identitytoken: identitytoken
    },
    withCredentials: true,
    maxCount: maxCount,
    data: data
  }, /*#__PURE__*/React.createElement(_Button, {
    disabled: disabled
  }, " Upload"));
};
export default RcFileUpload;