fix(sellable): update addSellable function to use availableItems and enhance logging
This commit is contained in:
parent
8b4eaee510
commit
eef355a791
@ -109,10 +109,17 @@ export default function SellableItemsButton({
|
|||||||
const addSellable = async () => {
|
const addSellable = async () => {
|
||||||
if (selectedIndex === null || price === "" || amount === "") return;
|
if (selectedIndex === null || price === "" || amount === "") return;
|
||||||
|
|
||||||
const item = items[selectedIndex];
|
const item = availableItems[selectedIndex];
|
||||||
|
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|
||||||
|
console.log("Adding sellable", {
|
||||||
|
shopId: item.shop.id,
|
||||||
|
itemId: item.item_name,
|
||||||
|
price,
|
||||||
|
amount,
|
||||||
|
});
|
||||||
|
|
||||||
const res = await fetch("/api/sellable", {
|
const res = await fetch("/api/sellable", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
@ -272,7 +279,7 @@ export default function SellableItemsButton({
|
|||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="space-y-4">
|
<div className="max-h-56 space-y-4 overflow-y-auto rounded-lg pr-1">
|
||||||
{Object.entries(sellablesByShop).map(([shopId, items]) => (
|
{Object.entries(sellablesByShop).map(([shopId, items]) => (
|
||||||
<div key={shopId} className="rounded-lg bg-white/5 p-3">
|
<div key={shopId} className="rounded-lg bg-white/5 p-3">
|
||||||
<h4 className="mb-2 font-semibold">
|
<h4 className="mb-2 font-semibold">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user