prevent user going over max pages by narrowing search while page > 1

This commit is contained in:
Elijah R 2024-04-09 20:26:26 -04:00
parent 39313a5564
commit 57095b2371

View file

@ -111,6 +111,11 @@ elements.searchUsersForm.addEventListener('submit', async e => {
alert("Failed to list users: " + data.error); alert("Failed to list users: " + data.error);
return false; return false;
} }
if (page > data.totalPageCount!) {
elements.usersPage.value = data.totalPageCount!.toString(10);
elements.searchUsersForm.requestSubmit();
return false;
}
elements.usersTableBody.innerHTML = ""; elements.usersTableBody.innerHTML = "";
elements.usersPageCount.innerText = data.totalPageCount!.toString(10); elements.usersPageCount.innerText = data.totalPageCount!.toString(10);
elements.usersPage.max = data.totalPageCount!.toString(10); elements.usersPage.max = data.totalPageCount!.toString(10);
@ -196,6 +201,11 @@ elements.searchBotsForm.addEventListener('submit', async e => {
alert("Failed to list bots: " + data.error); alert("Failed to list bots: " + data.error);
return false; return false;
} }
if (page > data.totalPageCount!) {
elements.botsPage.value = data.totalPageCount!.toString(10);
elements.searchBotsForm.requestSubmit();
return false;
}
elements.botsTableBody.innerHTML = ""; elements.botsTableBody.innerHTML = "";
elements.botsPageCount.innerText = data.totalPageCount!.toString(10); elements.botsPageCount.innerText = data.totalPageCount!.toString(10);
elements.botsPage.max = data.totalPageCount!.toString(10); elements.botsPage.max = data.totalPageCount!.toString(10);