فهرست منبع

修复兑换码bug

CaIon 2 سال پیش
والد
کامیت
f01932dc34
2فایلهای تغییر یافته به همراه11 افزوده شده و 1 حذف شده
  1. 1 1
      web/package.json
  2. 10 0
      web/src/components/RedemptionsTable.js

+ 1 - 1
web/package.json

@@ -49,5 +49,5 @@
     "singleQuote": true,
     "jsxSingleQuote": true
   },
-  "proxy": "https://nekoapi.com"
+  "proxy": "http://localhost:3000"
 }

+ 10 - 0
web/src/components/RedemptionsTable.js

@@ -166,16 +166,26 @@ const RedemptionsTable = () => {
         setShowEdit(false);
     }
 
+    const setCount = (data) => {
+        if (data.length >= (activePage) * ITEMS_PER_PAGE) {
+            setTokenCount(data.length + 1);
+        } else {
+            setTokenCount(data.length);
+        }
+    }
+
     const loadRedemptions = async (startIdx) => {
         const res = await API.get(`/api/redemption/?p=${startIdx}`);
         const {success, message, data} = res.data;
         if (success) {
             if (startIdx === 0) {
                 setRedemptions(data);
+                setCount(data);
             } else {
                 let newRedemptions = redemptions;
                 newRedemptions.push(...data);
                 setRedemptions(newRedemptions);
+                setCount(newRedemptions);
             }
         } else {
             showError(message);