mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
add: load collections if empty.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { get } from 'svelte/store';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { collections as collectionsStore } from '../store';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
|
||||
export async function load({ depends, params }) {
|
||||
depends(Dependencies.COLLECTIONS);
|
||||
|
||||
let collections = get(collectionsStore);
|
||||
|
||||
if (collections.total === 0) {
|
||||
collections = await sdk.forProject.databases.listCollections(params.database);
|
||||
collectionsStore.set(collections);
|
||||
}
|
||||
|
||||
return { collections };
|
||||
}
|
||||
Reference in New Issue
Block a user