diff --git a/src/routes/admin/users/+page.svelte b/src/routes/admin/users/+page.svelte index 2188b59..d7c0fd7 100644 --- a/src/routes/admin/users/+page.svelte +++ b/src/routes/admin/users/+page.svelte @@ -20,7 +20,7 @@ let userFilter = { name: null, edition: null }; let userTableContainerElement: HTMLDivElement; - function fetchPageUsers(page: number, filter: any) { + function fetchPageUsers(page: number) { if (!browser) return; if (userTableContainerElement) userTableContainerElement.scrollTop = 0; @@ -29,7 +29,7 @@ currentPageUsersRequest = new Promise(async (resolve, reject) => { const response = await fetch(`${env.PUBLIC_BASE_PATH}/admin/users`, { method: 'POST', - body: JSON.stringify({ ...filter, limit: usersPerPage, from: usersPerPage * page }) + body: JSON.stringify({ ...userFilter, limit: usersPerPage, from: usersPerPage * page }) }); if (response.ok) { currentPageUsers = await response.json(); @@ -40,7 +40,10 @@ }); } - $: fetchPageUsers(userPage, userFilter); + $: fetchPageUsers(userPage); + // prettier-ignore + function fetchFilterPageUsers(_: any) { userPage == 0 ? fetchPageUsers(0) : userPage = 0 } + $: fetchFilterPageUsers(userFilter); let sortKey: string | null = null; let sortAsc = false; @@ -207,7 +210,7 @@