From 56f498eb088eeb93e8299bfe4bb638a8836f18e6 Mon Sep 17 00:00:00 2001 From: Master Date: Wed, 7 Jun 2023 06:52:56 +0800 Subject: [PATCH] fix bug --- src/controllers/api/purchaseController.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/controllers/api/purchaseController.ts b/src/controllers/api/purchaseController.ts index ec257c2e..d795bcea 100644 --- a/src/controllers/api/purchaseController.ts +++ b/src/controllers/api/purchaseController.ts @@ -30,6 +30,16 @@ const purchaseController = async (req: Request, res: Response): Promise => res.json({ InventoryChanges: response }); return; } + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + const item_name = storeItem.replace("StoreItems/", ""); + const new_item = items.find(i => { + return i.uniqueName == item_name; + }); + if (new_item) { + const response = await PurchaseItem(parseString(accountId), new_item, quantity, usePremium, price); + res.json({ InventoryChanges: response }); + return; + } res.json(purchase); };