diff options
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/sdk/auth.js')
| -rw-r--r-- | StoneIsland/platforms/ios/www/js/sdk/auth.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/StoneIsland/platforms/ios/www/js/sdk/auth.js b/StoneIsland/platforms/ios/www/js/sdk/auth.js index 8a72dd46..87ce60ea 100644 --- a/StoneIsland/platforms/ios/www/js/sdk/auth.js +++ b/StoneIsland/platforms/ios/www/js/sdk/auth.js @@ -95,15 +95,20 @@ var auth = sdk.auth = (function(){ auth.add_deferred_product_to_cart = function(cb){ // auth.deferred_product if (! auth.deferred_product) { + console.log("VV NO DEF PROD") cb && cb() return } sdk.cart.add_item({ data: auth.deferred_product, success: function(){ - console.log("ADDED") + console.log("ADDED ITEM") cb && cb() - } + }, + error: function(data){ + console.log("ERROR ADDING ITEM", data) + cb && cb() + }, }) auth.deferred_product = null app.header.increment_cart_count() @@ -112,13 +117,12 @@ var auth = sdk.auth = (function(){ auth.log_out = function(){ auth.clear_user() auth.clear_cart() - auth.view_logged_out() } auth.logged_in = function(){ - return (auth.user_id !== -1) && (auth.user_id !== "undefined") + return (auth.user_id && auth.user_id !== -1 && auth.user_id !== "undefined") } auth.has_cart = function(){ - return (sdk.cart.id !== -1) && (sdk.cart.id !== "undefined") + return (sdk.cart.id && sdk.cart.id !== -1 && sdk.cart.id !== "undefined") } return auth |
