Compare commits
No commits in common. "a8b0374d5e6c91bea604fce7c5aff4748cdabef9" and "4145dafb7d2567cafa6636a0d55e7b1a19b95574" have entirely different histories.
a8b0374d5e
...
4145dafb7d
@ -14,14 +14,15 @@ async function get(req: Request, res: Response) {
|
||||
const takeSize = 25; // Amount of times per page
|
||||
const pageSize = Math.ceil(itemCount / takeSize); // Amount of pages, always round up
|
||||
|
||||
// If page is less then 1 or more then the max page size redirect to first or last page. If itemCount is 0 do not redirect.
|
||||
// If page is less then 1 or more then the max page size redirect to first or last page
|
||||
if (page < 1) {
|
||||
res.redirect('?page=1');
|
||||
return;
|
||||
} else if (page > pageSize && itemCount !== 0) {
|
||||
} else if (page > pageSize) {
|
||||
res.redirect('?page=' + pageSize);
|
||||
return;
|
||||
}
|
||||
|
||||
prisma.item
|
||||
.findMany({ skip: (page - 1) * takeSize, take: takeSize }) // Skip the amount of items per page times the page number minus 1; skip has to be (page-1)*takeSize because skip is 0 indexed
|
||||
.then((items) => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
currentToasts = [];
|
||||
const currentToasts = [];
|
||||
|
||||
/**
|
||||
* Generic function to create a new toast
|
||||
|
Loading…
Reference in New Issue
Block a user