diff options
| author | Jules Laplace <jules@okfoc.us> | 2016-03-04 22:37:20 +0100 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2016-03-04 22:37:20 +0100 |
| commit | 08c203b4dc4b9fdacd9aa0f2f2074dbd7d431a80 (patch) | |
| tree | 40719f082ec67774654d10f50a332ea06ba23bb8 /StoneIsland/platforms/ios/www/js/lib/account/AccountView.js | |
| parent | 3a7ab01806ec52c048284029613b9bdaa0f6ec25 (diff) | |
checkin stuff
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/lib/account/AccountView.js')
| -rwxr-xr-x | StoneIsland/platforms/ios/www/js/lib/account/AccountView.js | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/StoneIsland/platforms/ios/www/js/lib/account/AccountView.js b/StoneIsland/platforms/ios/www/js/lib/account/AccountView.js index 7d3b719a..0d015ab3 100755 --- a/StoneIsland/platforms/ios/www/js/lib/account/AccountView.js +++ b/StoneIsland/platforms/ios/www/js/lib/account/AccountView.js @@ -98,25 +98,45 @@ var AccountView = View.extend({ } if ( ! auth.has_cart() ) { app.curtain.show("loading") - auth.create_cart(function(){ - if (auth.deferred_product) { - auth.add_deferred_product_to_cart(function(){ - app.router.go("cart") - setTimeout(function(){ - app.curtain.hide("loading") - }, 500) - }) - } - else { - app.router.go("account/profile") - app.curtain.hide("loading") - } + auth.create_cart({ + success: function(){ + if (auth.deferred_product) { + auth.add_deferred_product_to_cart({ + success: function(){ + app.router.go("cart") + setTimeout(function(){ + app.curtain.hide("loading") + }, 500) + }, + error: function(){ + // TODO: should not be called because cart was just created + console.log("ERROR ADDING PRODUCT TO NEW CART") + }, + }) + } + else { + app.router.go("account/profile") + app.curtain.hide("loading") + } + }, + error: function(){ + // error CREATING cart... + console.log("ERROR CREATING CART") + auth.log_out() + app.account.logged_out() + }, }) } else { if (auth.deferred_product) { - auth.add_deferred_product_to_cart(function(){ - app.router.go("cart") + auth.add_deferred_product_to_cart({ + success: function(){ + app.router.go("cart") + }, + error: function(){ + // TODO: cart might be invalid.. + console.log("CALLED LOGGED_IN, HAD DEFERRED PRODUCT") + }, }) } else { |
