mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-17 16:06:38 +08:00
修复兑换码bug
This commit is contained in:
parent
89be66b75b
commit
f01932dc34
@ -49,5 +49,5 @@
|
|||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"jsxSingleQuote": true
|
"jsxSingleQuote": true
|
||||||
},
|
},
|
||||||
"proxy": "https://nekoapi.com"
|
"proxy": "http://localhost:3000"
|
||||||
}
|
}
|
||||||
|
@ -166,16 +166,26 @@ const RedemptionsTable = () => {
|
|||||||
setShowEdit(false);
|
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 loadRedemptions = async (startIdx) => {
|
||||||
const res = await API.get(`/api/redemption/?p=${startIdx}`);
|
const res = await API.get(`/api/redemption/?p=${startIdx}`);
|
||||||
const {success, message, data} = res.data;
|
const {success, message, data} = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
if (startIdx === 0) {
|
if (startIdx === 0) {
|
||||||
setRedemptions(data);
|
setRedemptions(data);
|
||||||
|
setCount(data);
|
||||||
} else {
|
} else {
|
||||||
let newRedemptions = redemptions;
|
let newRedemptions = redemptions;
|
||||||
newRedemptions.push(...data);
|
newRedemptions.push(...data);
|
||||||
setRedemptions(newRedemptions);
|
setRedemptions(newRedemptions);
|
||||||
|
setCount(newRedemptions);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
|
Loading…
Reference in New Issue
Block a user