Commit efee4097 by CaIon

修复兑换码bug

parent f453dc0a
......@@ -49,5 +49,5 @@
"singleQuote": true,
"jsxSingleQuote": true
},
"proxy": "https://nekoapi.com"
"proxy": "http://localhost:3000"
}
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment