mirror of
https://github.com/thiloho/archtika.git
synced 2025-11-22 10:51:36 +01:00
Add pagination for logs route
This commit is contained in:
@@ -6,6 +6,8 @@ export const load: PageServerLoad = async ({ parent, fetch, params, cookies, url
|
||||
const userFilter = url.searchParams.get("logs_filter_user");
|
||||
const resourceFilter = url.searchParams.get("logs_filter_resource");
|
||||
const operationFilter = url.searchParams.get("logs_filter_operation");
|
||||
const currentPage = Number.parseInt(url.searchParams.get("logs_results_page") ?? "1");
|
||||
const resultOffset = currentPage === 1 ? 0 : currentPage * 50;
|
||||
|
||||
const searchParams = new URLSearchParams();
|
||||
|
||||
@@ -23,7 +25,7 @@ export const load: PageServerLoad = async ({ parent, fetch, params, cookies, url
|
||||
searchParams.append("operation", `eq.${operationFilter.toUpperCase()}`);
|
||||
}
|
||||
|
||||
const constructedFetchUrl = `${baseFetchUrl}&${searchParams.toString()}`;
|
||||
const constructedFetchUrl = `${baseFetchUrl}&${searchParams.toString()}&limit=50&offset=${resultOffset}`;
|
||||
|
||||
const changeLogData = await fetch(constructedFetchUrl, {
|
||||
method: "GET",
|
||||
|
||||
Reference in New Issue
Block a user