Skip to content

Commit 4b6e174

Browse files
authored
Merge pull request #2637 from appwrite/patches-to-pagination
Patches to parent branch
2 parents 6e1188c + 1c61fde commit 4b6e174

4 files changed

Lines changed: 255 additions & 203 deletions

File tree

src/lib/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export const PAGE_LIMIT = 12; // default page limit
22
export const SPREADSHEET_PAGE_LIMIT = 50; // default sheet page limit
33
export const CARD_LIMIT = 6; // default card limit
4+
export const DEFAULT_BILLING_PROJECTS_LIMIT = 5; // default billing projects page limit
45
export const INTERVAL = 5 * 60000; // default interval to check for feedback
56
export const NEW_DEV_PRO_UPGRADE_COUPON = 'appw50';
67

src/routes/(console)/organization-[organization]/billing/+page.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BillingPlan, Dependencies } from '$lib/constants';
1+
import { BillingPlan, DEFAULT_BILLING_PROJECTS_LIMIT, Dependencies } from '$lib/constants';
22
import type { Address } from '$lib/sdk/billing';
33
import { type Organization } from '$lib/stores/organization';
44
import { sdk } from '$lib/stores/sdk';
@@ -39,7 +39,7 @@ export const load: PageLoad = async ({ parent, depends, url, route }) => {
3939
let billingAggregation = null;
4040
try {
4141
const currentPage = getPage(url) || 1;
42-
const limit = getLimit(url, route, 5);
42+
const limit = getLimit(url, route, DEFAULT_BILLING_PROJECTS_LIMIT);
4343
const offset = pageToOffset(currentPage, limit);
4444
billingAggregation = await sdk.forConsole.billing.getAggregation(
4545
organization.$id,
@@ -94,8 +94,10 @@ export const load: PageLoad = async ({ parent, depends, url, route }) => {
9494
countryList,
9595
locale,
9696
nextPlan: billingPlanDowngrade,
97-
// expose pagination for components
98-
limit: getLimit(url, route, 5),
99-
offset: pageToOffset(getPage(url) || 1, getLimit(url, route, 5))
97+
limit: getLimit(url, route, DEFAULT_BILLING_PROJECTS_LIMIT),
98+
offset: pageToOffset(
99+
getPage(url) || 1,
100+
getLimit(url, route, DEFAULT_BILLING_PROJECTS_LIMIT)
101+
)
100102
};
101103
};

0 commit comments

Comments
 (0)