fix: set totalpage based on type

This commit is contained in:
skinmaker1345 2024-03-04 23:37:41 +09:00
parent ad90f8d699
commit f9289dd6c7

View File

@ -314,7 +314,7 @@ async function getBotList(type: ListType, page = 1, query?: string): Promise<Lis
type, type,
data: (await Promise.all(res.map(async (el) => await getBot(el.id)))).map((r) => ({ ...r })), data: (await Promise.all(res.map(async (el) => await getBot(el.id)))).map((r) => ({ ...r })),
currentPage: page, currentPage: page,
totalPage: Math.ceil(Number(count) / 8), totalPage: Math.ceil(Number(count) / (type === 'SEARCH' ? 8 : 16)),
} }
} }
@ -419,7 +419,7 @@ async function getServerList(type: ListType, page = 1, query?: string): Promise<
type, type,
data: (await Promise.all(res.map(async (el) => await getServer(el.id)))).map((r) => ({ ...r })), data: (await Promise.all(res.map(async (el) => await getServer(el.id)))).map((r) => ({ ...r })),
currentPage: page, currentPage: page,
totalPage: Math.ceil(Number(count) / 8), totalPage: Math.ceil(Number(count) / (type === 'SEARCH' ? 8 : 16)),
} }
} }