|
|
|
@ -136,13 +136,16 @@ const TaskListPage: React.FC = () => { |
|
|
|
|
try { |
|
|
|
|
const today = new Date().toISOString().substring(0, 10); |
|
|
|
|
const parsedPrice = parseInt(newPrice, 10);
|
|
|
|
|
if (!isNaN(parsedPrice)) { |
|
|
|
|
setNewStock({ ...newStock, price: parsedPrice }); |
|
|
|
|
}else{ |
|
|
|
|
console.log("newPrice") |
|
|
|
|
console.log(newPrice) |
|
|
|
|
console.log("parsedPrice") |
|
|
|
|
console.log(parsedPrice) |
|
|
|
|
if (isNaN(parsedPrice)) { |
|
|
|
|
alert('入力が無効です') |
|
|
|
|
return |
|
|
|
|
//setNewStock({ ...newStock, price: parsedPrice });
|
|
|
|
|
} |
|
|
|
|
await toBuyApi.buy({ tobuyId, ...newStock, lastUpdate: today }); //データベースに送信
|
|
|
|
|
await toBuyApi.buy({ tobuyId, ...newStock, price: parsedPrice, lastUpdate: today }); //データベースに送信
|
|
|
|
|
fetchTasks(); // 削除後の買うもの一覧を再取得
|
|
|
|
|
} catch (error) { |
|
|
|
|
console.error(`${TOBUY_ERRORS.BUY_FAILED}:`, error); |
|
|
|
|