Add error message on cart populate failure and don't keep re-sending the data to the server.

This was triggering many requests to be continuously re-sent in a very problematic way (server-melting), and with no user feedback.
This commit is contained in:
Matt-Yorkley
2020-05-04 12:35:19 +02:00
parent 9a7807b134
commit 13e4411b89
2 changed files with 6 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
Darkswarm.factory 'Cart', (CurrentOrder, Variants, $timeout, $http, $modal, $rootScope, $resource, localStorageService) ->
Darkswarm.factory 'Cart', (CurrentOrder, Variants, $timeout, $http, $modal, $rootScope, $resource, localStorageService, RailsFlashLoader) ->
# Handles syncing of current cart/order state to server
new class Cart
dirty: false
@@ -50,6 +50,7 @@ Darkswarm.factory 'Cart', (CurrentOrder, Variants, $timeout, $http, $modal, $roo
@popQueue() if @update_enqueued
.error (response, status)=>
RailsFlashLoader.loadFlash({error: t('js.cart.add_to_cart_failed')})
@update_running = false
compareAndNotifyStockLevels: (stockLevels) =>

View File

@@ -2438,6 +2438,10 @@ See the %{link} to find out more about %{sitename}'s features and to start using
resolve_errors: Please resolve the following errors
more_items: "+ %{count} More"
default_card_updated: Default Card Updated
cart:
add_to_cart_failed: >
There was a problem adding this product to the cart.
Perhaps it has become unavailable or the shop is closing.
admin:
enterprise_limit_reached: "You have reached the standard limit of enterprises per account. Write to %{contact_email} if you need to increase it."
modals: