mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
remove query param offset pagination
This commit is contained in:
1 parent
2cdf92162a
commit
b07a37189b
2 files changed
+4
-30
No files matched your search
@@ -20,12 +20,11 @@
|
||||
import { Container } from '$lib/layout';
|
||||
import { base } from '$app/paths';
|
||||
import { usersList } from './store';
|
||||
import { onMount } from 'svelte';
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
|
||||
let showCreate = false;
|
||||
let search = '';
|
||||
let offset: number = null;
|
||||
let offset = 0;
|
||||
|
||||
const limit = 5;
|
||||
const project = $page.params.project;
|
||||
@@ -34,22 +33,8 @@
|
||||
await goto(`${base}/console/${project}/users/user/${event.detail.$id}`);
|
||||
};
|
||||
|
||||
$: usersList.load(search, limit, offset ?? 0);
|
||||
$: if (search) offset = 0;
|
||||
$: {
|
||||
//TODO: refactor this into something maintainable without the use of goto
|
||||
if (offset !== null) {
|
||||
$page.url.searchParams.set('offset', offset.toString());
|
||||
goto(`?${$page.url.searchParams.toString()}`, { replaceState: true, keepfocus: true });
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
const queryOffset = +$page.url.searchParams.get('offset') ?? 0;
|
||||
if (offset && offset !== queryOffset) {
|
||||
offset = queryOffset;
|
||||
}
|
||||
});
|
||||
$: usersList.load(search, limit, offset ?? 0);
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
import { Container } from '$lib/layout';
|
||||
import { base } from '$app/paths';
|
||||
import { teamsList } from './store';
|
||||
import { onMount } from 'svelte';
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
|
||||
let search = '';
|
||||
@@ -32,19 +31,9 @@
|
||||
const teamCreated = async (event: CustomEvent<Models.Team>) => {
|
||||
await goto(`${base}/console/${project}/users/teams/${event.detail.$id}`);
|
||||
};
|
||||
$: teamsList.load(search, limit, offset);
|
||||
$: if (search) offset = 0;
|
||||
$: {
|
||||
//TODO: refactor this into something maintainable without the use of goto
|
||||
if (offset !== null) {
|
||||
$page.url.searchParams.set('offset', offset.toString());
|
||||
goto(`?${$page.url.searchParams.toString()}`, { replaceState: true, keepfocus: true });
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
offset = +$page.url.searchParams.get('offset') ?? 0;
|
||||
});
|
||||
$: if (search) offset = 0;
|
||||
$: teamsList.load(search, limit, offset);
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
|
||||
Reference in new issue
Block a user