From ceb49ed31441923f84795bbf5242c4c3252698ee Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 25 Nov 2015 04:19:11 -0500 Subject: fix auth bugs pt 2 --- StoneIsland/www/js/lib/account/AccountView.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'StoneIsland/www/js/lib/account/AccountView.js') diff --git a/StoneIsland/www/js/lib/account/AccountView.js b/StoneIsland/www/js/lib/account/AccountView.js index ddca9666..86c02056 100644 --- a/StoneIsland/www/js/lib/account/AccountView.js +++ b/StoneIsland/www/js/lib/account/AccountView.js @@ -39,22 +39,32 @@ var AccountView = View.extend({ }) $("#nav .login").hide() $("#nav .account, #nav .logout").show() - if (app.last_view && app.last_view != app.login && app.last_view != app.signin && app.last_view != app.logout) { - app.view && app.view.hide && app.view.hide() - app.view = app.last_view - app.view.show() + if (! auth.deferred_product && app.last_view) { + if (app.last_view != app.login && app.last_view != app.signin && app.last_view != app.logout) { + app.view && app.view.hide && app.view.hide() + app.view = app.last_view + app.view.show() + } } else { cb && cb() } if ( ! auth.has_cart() ) { - console.log("VV make cart") - auth.create_cart(auth.add_deferred_product_to_cart) + app.curtain.show("loading") + auth.create_cart(function(){ + auth.add_deferred_product_to_cart(function(){ + app.router.go("cart") + setTimeout(function(){ + app.curtain.hide("loading") + }, 500) + }) + }) } else { if (auth.deferred_product) { - console.log("VV got def prod", auth.deferred_product) - auth.add_deferred_product_to_cart() + auth.add_deferred_product_to_cart(function(){ + app.router.go("cart") + }) } else { app.cart.load() -- cgit v1.2.3-70-g09d2