mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: storage waterfall
This commit is contained in:
@@ -4,7 +4,6 @@ import { getLimit, getPage, getSearch, pageToOffset } from '$lib/helpers/load';
|
||||
import { Dependencies, PAGE_LIMIT } from '$lib/constants';
|
||||
import type { PageLoad } from './$types';
|
||||
import { isCloud } from '$lib/system';
|
||||
import type { OrganizationUsage } from '$lib/sdk/billing';
|
||||
|
||||
export const load: PageLoad = async ({ params, depends, url, route, parent }) => {
|
||||
const { organization } = await parent();
|
||||
@@ -13,20 +12,20 @@ export const load: PageLoad = async ({ params, depends, url, route, parent }) =>
|
||||
const search = getSearch(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
let organizationUsage: OrganizationUsage = null;
|
||||
if (isCloud && organization?.$id) {
|
||||
organizationUsage = await sdk.forConsole.billing.listUsage(organization.$id);
|
||||
}
|
||||
|
||||
return {
|
||||
offset,
|
||||
limit,
|
||||
search,
|
||||
files: await sdk.forProject.storage.listFiles(
|
||||
const [files, organizationUsage] = await Promise.all([
|
||||
sdk.forProject.storage.listFiles(
|
||||
params.bucket,
|
||||
[Query.limit(limit), Query.offset(offset), Query.orderDesc('')],
|
||||
search
|
||||
),
|
||||
isCloud && organization?.$id ? sdk.forConsole.billing.listUsage(organization.$id) : null
|
||||
]);
|
||||
return {
|
||||
offset,
|
||||
limit,
|
||||
search,
|
||||
files,
|
||||
organizationUsage
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user