diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-11-25 04:08:39 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-11-25 04:08:39 -0500 |
| commit | f0c551933c5e725b980014b559d757bee99d0536 (patch) | |
| tree | ba8f090c42934f3ef601eb8d0e42b4398242fc68 /StoneIsland/www/js/sdk | |
| parent | e024c35a2584f5d975b3b4f8fe942bb8e35b6e47 (diff) | |
fix auth bugs pt 1
Diffstat (limited to 'StoneIsland/www/js/sdk')
| -rw-r--r-- | StoneIsland/www/js/sdk/auth.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/StoneIsland/www/js/sdk/auth.js b/StoneIsland/www/js/sdk/auth.js index 8a72dd46..87ce60ea 100644 --- a/StoneIsland/www/js/sdk/auth.js +++ b/StoneIsland/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 |
