mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-30 19:52:20 +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
|
def destroy
|
||||||
authorize @product
|
authorize @product
|
||||||
|
begin
|
||||||
ProductService.destroy(@product)
|
ProductService.destroy(@product)
|
||||||
head :no_content
|
head :no_content
|
||||||
|
rescue StandardError => e
|
||||||
|
render json: e, status: :unprocessable_entity
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def stock_movements
|
def stock_movements
|
||||||
|
@ -40,7 +40,9 @@ export const StoreProductItem: React.FC<StoreProductItemProps> = ({ product, car
|
|||||||
const addProductToCart = (e: React.BaseSyntheticEvent) => {
|
const addProductToCart = (e: React.BaseSyntheticEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
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 => {
|
CartAPI.addItem(cart, product.id, toCartCount).then(data => {
|
||||||
setCart(data);
|
setCart(data);
|
||||||
onSuccess(t('app.public.store_product.add_to_cart_success'));
|
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"
|
documentation: "Documentation"
|
||||||
minimum_purchase: "Minimum purchase: "
|
minimum_purchase: "Minimum purchase: "
|
||||||
add_to_cart: "Add to cart"
|
add_to_cart: "Add to cart"
|
||||||
|
stock_limit: "You have reached the current stock limit"
|
||||||
stock_status:
|
stock_status:
|
||||||
available: "Available"
|
available: "Available"
|
||||||
limited_stock: "Limited stock"
|
limited_stock: "Limited stock"
|
||||||
@ -416,6 +417,7 @@ en:
|
|||||||
minimum_purchase: "Minimum purchase: "
|
minimum_purchase: "Minimum purchase: "
|
||||||
add: "Add"
|
add: "Add"
|
||||||
add_to_cart: "Add to cart"
|
add_to_cart: "Add to cart"
|
||||||
|
stock_limit: "You have reached the current stock limit"
|
||||||
product_price:
|
product_price:
|
||||||
per_unit: "/ unit"
|
per_unit: "/ unit"
|
||||||
free: "Free"
|
free: "Free"
|
||||||
|
@ -408,6 +408,7 @@ fr:
|
|||||||
documentation: "Documentation"
|
documentation: "Documentation"
|
||||||
minimum_purchase: "Achat minimum : "
|
minimum_purchase: "Achat minimum : "
|
||||||
add_to_cart: "Ajouter au panier"
|
add_to_cart: "Ajouter au panier"
|
||||||
|
stock_limit: "Vous avez atteint la limite actuelle de stock"
|
||||||
stock_status:
|
stock_status:
|
||||||
available: "Disponible"
|
available: "Disponible"
|
||||||
limited_stock: "Stock limité"
|
limited_stock: "Stock limité"
|
||||||
@ -416,6 +417,7 @@ fr:
|
|||||||
minimum_purchase: "Achat minimum : "
|
minimum_purchase: "Achat minimum : "
|
||||||
add: "Ajouter"
|
add: "Ajouter"
|
||||||
add_to_cart: "Ajouter au panier"
|
add_to_cart: "Ajouter au panier"
|
||||||
|
stock_limit: "Vous avez atteint la limite actuelle de stock"
|
||||||
product_price:
|
product_price:
|
||||||
per_unit: "/ unité"
|
per_unit: "/ unité"
|
||||||
free: "Gratuit"
|
free: "Gratuit"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user