function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
import { message } from 'antd';
import { commonUse } from "../data";

/**
 * @description 接口返回异常提示语
 * @params {String或Object} type 指操作的类型：
 *   @value {String} 值有 删除:'delete' 修改:'update'  新增:'create'
 *   @value {Object} { success: 'xxx成功提示语'}
 *
 * @params {Object} res 接口返回数据
 * @params {Function} callback 事件回调
 * */
var responseControl = function responseControl(type, res, callback) {
  if (res.code == '200') {
    if (typeof type === 'string') {
      // @ts-ignore
      message.success(commonUse.responseMsg[type].success);
    } else if (_typeof(type) === 'object') {
      message.success(type.success);
    } else {
      message.success((res === null || res === void 0 ? void 0 : res.msg) || '操作成功');
    }
  }
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions
  callback && callback(res);
};
/**
 * @description 接口返回正常回调判断
 * @params {Object} res 接口返回数据
 * @params {Function} callback 事件回调
 * */
var responseQuery = function responseQuery(res, callback) {
  if (res.code == '200') {
    // 调用回调
    // eslint-disable-next-line @typescript-eslint/no-unused-expressions
    callback && callback(res);
  }
};
export { responseControl, responseQuery };