sslcommerz
Version:
### Installation
21 lines (20 loc) • 1.02 kB
JavaScript
;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
exports.__esModule = true;
exports.httpCall = void 0;
var fetch = require("isomorphic-fetch");
exports.httpCall = function (_a) {
var url = _a.url, _b = _a.method, method = _b === void 0 ? 'POST' : _b, _c = _a.data, data = _c === void 0 ? {} : _c;
// Default options are marked with *
return fetch(url, __assign({ method: method, mode: 'cors', cache: 'no-cache', credentials: 'same-origin', redirect: 'follow', referrer: 'no-referrer' }, ["POST", 'PUT', "PATCH", "UPDATE"].includes(method) && { body: data })).then(function (response) { return response.json(); })["catch"](function (err) { return err; });
};