"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.praise = exports.getPriseList = exports.cancelPraise = void 0;

var _axios = _interopRequireDefault(require("axios"));

var _BSGlobal$tenantInfo, _BSGlobal$loginUserIn;

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var tenantId = BSGlobal && ((_BSGlobal$tenantInfo = BSGlobal.tenantInfo) === null || _BSGlobal$tenantInfo === void 0 ? void 0 : _BSGlobal$tenantInfo.Id) || 0;
var userId = BSGlobal && ((_BSGlobal$loginUserIn = BSGlobal.loginUserInfo) === null || _BSGlobal$loginUserIn === void 0 ? void 0 : _BSGlobal$loginUserIn.Id) || 0;

var requestDomain = function requestDomain() {
  if (!window.location.hostname.match(/dev/)) return "";
  return "http://www.tita.gift";
};

var praise = function praise(feedId, type) {
  return _axios["default"].post("".concat(requestDomain(), "/api/v1/").concat(tenantId, "/").concat(userId, "/praise/feed?feedId=").concat(feedId, "&praiseType=").concat(type)).then(function (feed) {
    return feed.data;
  });
};

exports.praise = praise;

var cancelPraise = function cancelPraise(feedId) {
  return _axios["default"].post("".concat(requestDomain(), "/api/v1/").concat(tenantId, "/").concat(userId, "/praise/feed/cancel?feedId=").concat(feedId));
};

exports.cancelPraise = cancelPraise;

var getPriseList = function getPriseList(_ref) {
  var feedId = _ref.feedId,
      _ref$start = _ref.start,
      start = _ref$start === void 0 ? "" : _ref$start,
      _ref$count = _ref.count,
      count = _ref$count === void 0 ? 20 : _ref$count;
  return _axios["default"].get("".concat(requestDomain(), "/api/v1/").concat(tenantId, "/").concat(userId, "/praise/get?objId=").concat(feedId, "&start=").concat(start, "&count=").concat(count, "&objType=10")).then(function (praise) {
    return praise.data;
  });
};

exports.getPriseList = getPriseList;