UNPKG

@zhiguang-gastrofy/capi

Version:

comany apis, including Northfork api and Gastrofy api

53 lines 1.8 kB
"use strict"; // TODO: // move some parts of resolver to this file Object.defineProperty(exports, "__esModule", { value: true }); //import { CartService } from './cart.service'; var CART_CACHE = 'nf_cart'; var ShoppingService = /** @class */ (function () { function ShoppingService() { //_cartApi: any; this.calculationType = ''; this.prioritization = ''; this.storeIdentifier = ''; this.storeProvider = ''; this.recipes = []; this.products = []; this.productExceptions = []; //this._cartApi = new CartService(); } ShoppingService.prototype.getCart = function (customerToken, userId) { var _this = this; var promise; if (!userId) { promise = new Promise(function (resolve) { var cart = localStorage.getItem(CART_CACHE); resolve(cart ? JSON.parse(cart) : null); }); } else { //promise = this._cartApi.get( customerToken, userId ); } return promise.then(function (cart) { if (!cart) { cart = { calculation_type: _this.calculationType, prioritization: _this.prioritization, store: { identifier: _this.storeIdentifier, provider: _this.storeProvider }, recipes: _this.recipes, products: _this.products, product_exceptions: _this.productExceptions, }; } else { } return cart; }); }; return ShoppingService; }()); exports.ShoppingService = ShoppingService; //# sourceMappingURL=shopping.service.js.map