basic selection + download multiple files with selection
This commit is contained in:
@@ -149,7 +149,7 @@ export async function fetchShareFile(
|
||||
password: string | null
|
||||
): Promise<{ success: true; data: Blob } | { success: false }> {
|
||||
const { data } = await useFetch<Blob>(
|
||||
getApiUrl(`warrens/files/cat_share?shareId=${shareId}&path=${path}`),
|
||||
getApiUrl(`warrens/files/cat_share?shareId=${shareId}&paths=${path}`),
|
||||
{
|
||||
method: 'GET',
|
||||
headers:
|
||||
|
||||
@@ -273,14 +273,27 @@ export async function fetchFile(
|
||||
warrenId: string,
|
||||
path: string,
|
||||
fileName: string
|
||||
): Promise<{ success: true; data: Blob } | { success: false }> {
|
||||
return fetchFiles(warrenId, path, [fileName]);
|
||||
}
|
||||
|
||||
export async function fetchFiles(
|
||||
warrenId: string,
|
||||
path: string,
|
||||
fileNames: string[]
|
||||
): Promise<{ success: true; data: Blob } | { success: false }> {
|
||||
if (!path.endsWith('/')) {
|
||||
path += '/';
|
||||
}
|
||||
path += fileName;
|
||||
const paths = [];
|
||||
for (const fileName of fileNames) {
|
||||
paths.push(path + fileName);
|
||||
}
|
||||
|
||||
const { data, error } = await useFetch<Blob>(
|
||||
getApiUrl(`warrens/files/cat?warrenId=${warrenId}&path=${path}`),
|
||||
getApiUrl(
|
||||
`warrens/files/cat?warrenId=${warrenId}&paths=${paths.join(':')}`
|
||||
),
|
||||
{
|
||||
method: 'GET',
|
||||
headers: getApiHeaders(),
|
||||
@@ -314,7 +327,7 @@ export async function fetchFileStream(
|
||||
path += fileName;
|
||||
|
||||
const { data, error } = await useFetch<ReadableStream<Uint8Array>>(
|
||||
getApiUrl(`warrens/files/cat?warrenId=${warrenId}&path=${path}`),
|
||||
getApiUrl(`warrens/files/cat?warrenId=${warrenId}&paths=${path}`),
|
||||
{
|
||||
method: 'GET',
|
||||
headers: getApiHeaders(),
|
||||
|
||||
Reference in New Issue
Block a user