mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
add: loaded collections to store.
This commit is contained in:
@@ -3,6 +3,7 @@ import { sdk } from '$lib/stores/sdk';
|
||||
import { getLimit, getPage, getView, pageToOffset, View } from '$lib/helpers/load';
|
||||
import type { PageLoad } from './$types';
|
||||
import { CARD_LIMIT, Dependencies } from '$lib/constants';
|
||||
import { collections as collectionsStore } from './store';
|
||||
|
||||
export const load: PageLoad = async ({ params, url, route, depends }) => {
|
||||
depends(Dependencies.COLLECTIONS);
|
||||
@@ -10,15 +11,18 @@ export const load: PageLoad = async ({ params, url, route, depends }) => {
|
||||
const limit = getLimit(url, route, CARD_LIMIT);
|
||||
const view = getView(url, route, View.Grid);
|
||||
const offset = pageToOffset(page, limit);
|
||||
const collections = await sdk.forProject.databases.listCollections(params.database, [
|
||||
Query.limit(limit),
|
||||
Query.offset(offset),
|
||||
Query.orderDesc('')
|
||||
]);
|
||||
|
||||
collectionsStore.set(collections);
|
||||
|
||||
return {
|
||||
offset,
|
||||
limit,
|
||||
view,
|
||||
collections: await sdk.forProject.databases.listCollections(params.database, [
|
||||
Query.limit(limit),
|
||||
Query.offset(offset),
|
||||
Query.orderDesc('')
|
||||
])
|
||||
collections
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user