mirror of
https://github.com/linux-do/new-api.git
synced 2026-02-12 08:04:25 +08:00
更新渠道管理
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -164,11 +164,24 @@ const RedemptionsTable = () => {
|
||||
setShowEdit(false);
|
||||
}
|
||||
|
||||
const setCount = (data) => {
|
||||
if (data.length >= (activePage) * ITEMS_PER_PAGE) {
|
||||
setTokenCount(data.length + 1);
|
||||
// const setCount = (data) => {
|
||||
// if (data.length >= (activePage) * ITEMS_PER_PAGE) {
|
||||
// setTokenCount(data.length + 1);
|
||||
// } else {
|
||||
// setTokenCount(data.length);
|
||||
// }
|
||||
// }
|
||||
|
||||
const setRedemptionFormat = (redeptions) => {
|
||||
for (let i = 0; i < redeptions.length; i++) {
|
||||
redeptions[i].key = '' + redeptions[i].id;
|
||||
}
|
||||
// data.key = '' + data.id
|
||||
setRedemptions(redeptions);
|
||||
if (redeptions.length >= (activePage) * ITEMS_PER_PAGE) {
|
||||
setTokenCount(redeptions.length + 1);
|
||||
} else {
|
||||
setTokenCount(data.length);
|
||||
setTokenCount(redeptions.length);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,13 +190,11 @@ const RedemptionsTable = () => {
|
||||
const {success, message, data} = res.data;
|
||||
if (success) {
|
||||
if (startIdx === 0) {
|
||||
setRedemptions(data);
|
||||
setCount(data);
|
||||
setRedemptionFormat(data);
|
||||
} else {
|
||||
let newRedemptions = redemptions;
|
||||
newRedemptions.push(...data);
|
||||
setRedemptions(newRedemptions);
|
||||
setCount(newRedemptions);
|
||||
setRedemptionFormat(newRedemptions);
|
||||
}
|
||||
} else {
|
||||
showError(message);
|
||||
|
||||
Reference in New Issue
Block a user