const param = function()

in linkis-web/src/common/service/api.js [225:271]


const param = function (url, data, option) {
  let method = 'post';
  if (util.isNull(url)) {
    return window.console.error('请传入URL');
  } else if (!util.isNull(url) && util.isNull(data) && util.isNull(option)) {
    option = {
      method: method,
    };
  } else if (!util.isNull(url) && !util.isNull(data) && util.isNull(option)) {
    option = {
      method: method,
    };
    if (util.isString(data)) {
      option.method = data;
    } else if (util.isObject(data)) {
      option.data = data;
    }
  } else if (!util.isNull(url) && !util.isNull(data) && !util.isNull(option)) {
    if (!util.isObject(data)) {
      data = {};
    }
    if (util.isString(option)) {
      option = {
        method: option,
      };
    } else if (util.isObject(option)) {
      option.method = option.method || method;
    } else {
      option = {
        method: method,
      };
    }
    if (option.method == 'get' || option.method == 'delete' || option.method == 'head' || option.method == 'options') {
      option.params = data;
    }
    if (option.method == 'post' || option.method == 'put' || option.method == 'patch') {
      option.data = data;
    }
  }
  // cacheOptions interface data cache {time} When the time is 0, the data cached in the memory will not be cleaned up after the request(cacheOptions接口数据缓存 {time} time为0则请求之后缓存在内存里的数据不清理)
  if (option.cacheOptions) {
    option.adapter = cache(option.cacheOptions)
  }
  option.url = url;

  return instance.request(option);
};