summaryrefslogtreecommitdiff
path: root/StoneIsland/platforms/ios/www/js/lib/account/AccountView.js
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/lib/account/AccountView.js')
-rwxr-xr-xStoneIsland/platforms/ios/www/js/lib/account/AccountView.js50
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 {