카테고리 목록에서 파일 목록을 재귀적으로 표시할 수 있는 기능 구현

This commit is contained in:
static
2025-01-22 22:24:44 +09:00
parent 8f8bad6d10
commit f34764ffe0
9 changed files with 98 additions and 41 deletions

View File

@@ -66,7 +66,7 @@ export type CategoryInfo =
dataKeyVersion?: Date;
name: string;
subCategoryIds: number[];
files: number[];
files: { id: number; isRecursive: boolean }[];
};
const directoryInfoStore = new Map<DirectoryId, Writable<DirectoryInfo | null>>();
@@ -256,7 +256,7 @@ const fetchCategoryInfoFromServer = async (
const { dataKey } = await unwrapDataKey(metadata!.dek, masterKey);
const name = await decryptString(metadata!.name, metadata!.nameIv, dataKey);
res = await callGetApi(`/api/category/${id}/file/list`);
res = await callGetApi(`/api/category/${id}/file/list?recursive=true`);
if (!res.ok) {
throw new Error("Failed to fetch category files");
}
@@ -269,7 +269,7 @@ const fetchCategoryInfoFromServer = async (
dataKeyVersion: new Date(metadata!.dekVersion),
name,
subCategoryIds: subCategories,
files,
files: files.map(({ file, isRecursive }) => ({ id: file, isRecursive })),
});
}
};