@arc-publishing/sdk-sales
Version:
JS Sales SDK for working with Arc Subs Sales API
26 lines • 884 B
JavaScript
import { __assign } from "tslib";
import JSONResponseHandler from '@arc-publishing/sdk-subs-core/lib/utils/JSONResponseHandler';
import { headers } from './constants';
import Sales from './sales';
import { isCart } from './order';
export default function removeItemFromCart(sku) {
return Sales._Identity
.heartbeat()
.then(function () {
return fetch("".concat(Sales.apiOrigin, "/sales/public/v1/cart/item/").concat(sku), {
method: 'DELETE',
headers: __assign({ Authorization: "Bearer ".concat(Sales._Identity.userIdentity.accessToken) }, headers)
});
})
.then(JSONResponseHandler)
.then(function (json) {
if (isCart(json)) {
Sales.cart = json;
return json;
}
else {
throw json;
}
});
}
//# sourceMappingURL=removeItemFromCart.js.map