@arc-publishing/sdk-sales
Version:
JS Sales SDK for working with Arc Subs Sales API
30 lines • 1.22 kB
JavaScript
import { __awaiter, __generator } from "tslib";
import JSONResponseHandler from '@arc-publishing/sdk-subs-core/lib/utils/JSONResponseHandler';
import { headers } from './constants';
import { getOptions } from './utils';
import Sales from './sales';
import { isCart } from './order';
export default function getCart() {
return __awaiter(this, void 0, void 0, function () {
var options;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, getOptions({ method: 'GET', headers: headers })];
case 1:
options = _a.sent();
return [2, fetch("".concat(Sales.apiOrigin, "/sales/public/v1/cart"), options)
.then(JSONResponseHandler)
.then(function (json) {
if (isCart(json)) {
Sales.cart = json;
return json;
}
else {
throw json;
}
})];
}
});
});
}
//# sourceMappingURL=getCart.js.map