mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-18 07:52:23 +01:00
(bug) fix product and order error message
This commit is contained in:
parent
b9397388c5
commit
48de0f8b9e
@ -48,8 +48,12 @@ class API::ProductsController < API::ApiController
|
||||
|
||||
def destroy
|
||||
authorize @product
|
||||
ProductService.destroy(@product)
|
||||
head :no_content
|
||||
begin
|
||||
ProductService.destroy(@product)
|
||||
head :no_content
|
||||
rescue StandardError => e
|
||||
render json: e, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def stock_movements
|
||||
|
@ -40,7 +40,9 @@ export const StoreProductItem: React.FC<StoreProductItemProps> = ({ product, car
|
||||
const addProductToCart = (e: React.BaseSyntheticEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
CartAPI.addItem(cart, product.id, 1).then(onSuccessAddProductToCart).catch(onError);
|
||||
CartAPI.addItem(cart, product.id, 1).then(onSuccessAddProductToCart).catch(() => {
|
||||
onError(t('app.public.store_product_item.stock_limit'));
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -110,7 +110,9 @@ export const StoreProduct: React.FC<StoreProductProps> = ({ productSlug, current
|
||||
CartAPI.addItem(cart, product.id, toCartCount).then(data => {
|
||||
setCart(data);
|
||||
onSuccess(t('app.public.store_product.add_to_cart_success'));
|
||||
}).catch(onError);
|
||||
}).catch(() => {
|
||||
onError(t('app.public.store_product.stock_limit'));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -408,6 +408,7 @@ en:
|
||||
documentation: "Documentation"
|
||||
minimum_purchase: "Minimum purchase: "
|
||||
add_to_cart: "Add to cart"
|
||||
stock_limit: "You have reached the current stock limit"
|
||||
stock_status:
|
||||
available: "Available"
|
||||
limited_stock: "Limited stock"
|
||||
@ -416,6 +417,7 @@ en:
|
||||
minimum_purchase: "Minimum purchase: "
|
||||
add: "Add"
|
||||
add_to_cart: "Add to cart"
|
||||
stock_limit: "You have reached the current stock limit"
|
||||
product_price:
|
||||
per_unit: "/ unit"
|
||||
free: "Free"
|
||||
|
@ -408,6 +408,7 @@ fr:
|
||||
documentation: "Documentation"
|
||||
minimum_purchase: "Achat minimum : "
|
||||
add_to_cart: "Ajouter au panier"
|
||||
stock_limit: "Vous avez atteint la limite actuelle de stock"
|
||||
stock_status:
|
||||
available: "Disponible"
|
||||
limited_stock: "Stock limité"
|
||||
@ -416,6 +417,7 @@ fr:
|
||||
minimum_purchase: "Achat minimum : "
|
||||
add: "Ajouter"
|
||||
add_to_cart: "Ajouter au panier"
|
||||
stock_limit: "Vous avez atteint la limite actuelle de stock"
|
||||
product_price:
|
||||
per_unit: "/ unité"
|
||||
free: "Gratuit"
|
||||
|
Loading…
x
Reference in New Issue
Block a user