fix: account organizations pagination

This commit is contained in:
Arman
2022-11-17 11:31:59 +01:00
parent 81ca10d2ff
commit a8db1d4e0f
2 changed files with 4 additions and 4 deletions
@@ -46,7 +46,7 @@
{#if index >= data.offset && index < CARD_LIMIT + data.offset}
<GridItem1 href={`${base}/console/organization-${organization.$id}`}>
<svelte:fragment slot="eyebrow">
{organization?.total ? organization?.total : 'No'} projects
{organization?.total ? organization?.total : 'No'} members
</svelte:fragment>
<svelte:fragment slot="title">
{organization.name}
@@ -1,18 +1,18 @@
import { Query } from '@aw-labs/appwrite-console';
import { sdkForConsole } from '$lib/stores/sdk';
import { pageToOffset } from '$lib/helpers/load';
import { PAGE_LIMIT } from '$lib/constants';
import { CARD_LIMIT } from '$lib/constants';
import type { PageLoad } from './$types';
export const load: PageLoad = async ({ params }) => {
const page = Number(params.page);
const offset = pageToOffset(page, PAGE_LIMIT);
const offset = pageToOffset(page, CARD_LIMIT);
return {
offset,
organizations: await sdkForConsole.teams.list([
Query.offset(offset),
Query.limit(PAGE_LIMIT)
Query.limit(CARD_LIMIT)
])
};
};