From 69890f479cc9dc22bdf0a6a765135dfe9a98416c Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 23 Nov 2015 04:54:04 -0500 Subject: prefetch cart --- StoneIsland/www/js/lib/account/AccountView.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'StoneIsland/www/js/lib/account') diff --git a/StoneIsland/www/js/lib/account/AccountView.js b/StoneIsland/www/js/lib/account/AccountView.js index c6f68e88..e9022d64 100644 --- a/StoneIsland/www/js/lib/account/AccountView.js +++ b/StoneIsland/www/js/lib/account/AccountView.js @@ -47,8 +47,16 @@ var AccountView = View.extend({ else { cb && cb() } - if (auth.deferred_product) { - auth.add_deferred_product_to_cart() + if ( ! auth.has_cart() ) { + auth.create_cart(auth.add_deferred_product_to_cart) + } + else { + if (auth.deferred_product) { + auth.add_deferred_product_to_cart( app.cart.load.bind(app.cart) ) + } + else { + app.cart.load() + } } }, -- cgit v1.2.3-70-g09d2