summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--StoneIsland/www/js/lib/account/AccountView.js26
1 files changed, 18 insertions, 8 deletions
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()