・在庫追加で現在の数量または価格に空文字が入った状態で追加ボタンを押したときのエラーメッセージを表示

・編集画面で購入時の数量が空文字でもエラーが出ないようにした
feature-frontend-stock-suzuki-ver3
Yuna.Suzuki 4 months ago
parent 615f9bd607
commit ac722fce47
  1. 16
      frontend/src/pages/StockPage.tsx

@ -106,8 +106,14 @@ const StockPage: React.FC = () => {
if (newStock.newAddition) {
newStock.stuffId = null;
}
if (isNaN(newStock.amount)) return;
if (isNaN(newStock.price)) return;
if (isNaN(newStock.amount)) {
showErrorMessage(GENERAL_ERRORS.INVALID_AMOUNT);
return;
}
if (isNaN(newStock.price)) {
showErrorMessage(GENERAL_ERRORS.INVALID_PRICE);
return;
}
if (newStock.buyAmount !== null && isNaN(newStock.buyAmount)) {
newStock.buyAmount = null;
@ -263,7 +269,11 @@ const StockPage: React.FC = () => {
setIsDeleteOpen(true); // 削除ダイアログを開く
return;
}
if (!numericAmount || !numericBuyAmount) {
// if (!numericAmount || !numericBuyAmount) {
// showErrorMessage(GENERAL_ERRORS.INVALID_AMOUNT);
// return;
// }
if (!numericAmount) {
showErrorMessage(GENERAL_ERRORS.INVALID_AMOUNT);
return;
}

Loading…
Cancel
Save