logout and login cart state is working now - except a little bug with icon on login
This commit is contained in:
@@ -27,20 +27,20 @@ post '/cart/item', &update_cart_item
|
||||
|
||||
|
||||
# gets list of items in cart without count
|
||||
get '/cart/item/display' do
|
||||
get '/cart/item/display' do
|
||||
cart = Cart.just_find(anonymous_id, logged_in_user_id)
|
||||
item_ids = cart.item_in_carts.map do |x|
|
||||
x.item_id
|
||||
x.item_id
|
||||
end
|
||||
items = []
|
||||
items = Item.find(item_ids) if cart.item_in_carts.length > 0
|
||||
items = Item.find(item_ids) if cart.item_in_carts.length > 0
|
||||
prepare_items_for_mass_display(items)
|
||||
end
|
||||
|
||||
get '/cart/delivery_destination' do
|
||||
get '/cart/delivery_destination' do
|
||||
cart = Cart.just_find(anonymous_id, logged_in_user_id)
|
||||
cart.delivery_destination.to_json(:except => [:created_at, :email_verification_code, :phone_verification_code])
|
||||
end
|
||||
end
|
||||
|
||||
update_delivery_destination = ->() {
|
||||
cart = Cart.just_find(anonymous_id, logged_in_user_id)
|
||||
@@ -54,7 +54,7 @@ put '/cart/delivery_destination', &update_delivery_destination
|
||||
post '/cart/delivery_destination', &update_delivery_destination
|
||||
|
||||
|
||||
post '/cart/confirmation' do
|
||||
post '/cart/confirmation' do
|
||||
anonymous = anonymous_id
|
||||
cart = Cart.just_find(anonymous, logged_in_user_id)
|
||||
if cart.item_in_carts.length > 0
|
||||
@@ -65,4 +65,4 @@ post '/cart/confirmation' do
|
||||
# in order for next call of Cart#just_find to be ready
|
||||
Cart.find_or_create(anonymous, logged_in_user_id)
|
||||
"OK".to_json
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user