feat(drive): add drive picker in sidebar
- select by default the home drive
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Drives endpoints. D0 ships read-only listing; mutations (create / rename /
|
||||
* member changes) land in D2/D3 and will be added here under the same shape.
|
||||
*
|
||||
* Consumers usually go through the `drives` store (`$lib/stores/drives.svelte`)
|
||||
* which dedupes the request and caches the list — touch this module directly
|
||||
* only when bypassing the cache is intentional (e.g. an explicit refresh).
|
||||
*/
|
||||
import { apiJson } from '$lib/api/client';
|
||||
import type { Drive } from '$lib/api/types';
|
||||
|
||||
/** `GET /api/drives` — every drive the caller can read, default first by convention. */
|
||||
export function listDrives(): Promise<Drive[]> {
|
||||
return apiJson<Drive[]>('/api/drives', { credentials: 'same-origin' });
|
||||
}
|
||||
@@ -103,11 +103,6 @@ function parseListing(raw: unknown): FolderListing {
|
||||
};
|
||||
}
|
||||
|
||||
/** Top-level folders for the user; the first entry is the home folder. */
|
||||
export function listRootFolders(): Promise<FolderItem[]> {
|
||||
return apiJson<FolderItem[]>('/api/folders', { credentials: 'same-origin' });
|
||||
}
|
||||
|
||||
export async function getFolder(id: string): Promise<FolderItem> {
|
||||
const folder = await apiJson<FolderItem>(`/api/folders/${id}`, NO_CACHE);
|
||||
rememberFolderName(folder.id, folder.name);
|
||||
|
||||
Reference in New Issue
Block a user