在庫追加時のエラーを実装

feature-frontend-design-fix
Masaharu.Kato 4 months ago
parent 6ae78c5d43
commit c790bebb92
  1. 17
      frontend/src/pages/StockPage.tsx

@ -123,8 +123,21 @@ const StockPage: React.FC = () => {
if (newStock.newAddition) {
newStock.stuffId = null;
}
if (isNaN(newStock.amount)) return;
if (newStock.price === null || isNaN(newStock.price)) return;
if (!newStock.stuffId && !newStock.stuffName) {
showErrorMessage(GENERAL_ERRORS.INVALID_STUFF_NAME);
return;
}
if (isNaN(newStock.amount)) {
showErrorMessage(GENERAL_ERRORS.INVALID_AMOUNT);
return;
}
if (newStock.price === null || isNaN(newStock.price)) {
showErrorMessage(GENERAL_ERRORS.INVALID_PRICE);
return;
}
if (newStock.buyAmount !== null && isNaN(newStock.buyAmount)) {
newStock.buyAmount = null;

Loading…
Cancel
Save