UNPKG

@arc-publishing/sdk-sales

Version:
30 lines 1.28 kB
import { __awaiter, __generator } from "tslib"; import { isAPIErrorResponse } from '@arc-publishing/sdk-subs-core/lib/utils/APIErrorResponse'; import JSONResponseHandler from '@arc-publishing/sdk-subs-core/lib/utils/JSONResponseHandler'; import { headers } from './constants'; import { getOptions } from './utils'; import Sales from './sales'; export default function onSwgPurchase(swgPurchaseData) { return __awaiter(this, void 0, void 0, function () { var options; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4, getOptions({ method: 'POST', headers: headers, body: swgPurchaseData })]; case 1: options = _a.sent(); return [2, fetch("".concat(Sales.apiOrigin, "/sales/public/v1/swg/purchase"), options) .then(JSONResponseHandler) .then(function (json) { if (isAPIErrorResponse(json)) { throw json; } })]; } }); }); } //# sourceMappingURL=onSwgPurchase.js.map