mirror of
https://github.com/Noooste/garage-ui.git
synced 2026-08-27 15:37:03 +00:00
feat: add CreateDirectory endpoint and S3 directory marker support
Signed-off-by: Noooste <83548733+Noooste@users.noreply.github.com>
This commit is contained in:
@@ -182,7 +182,7 @@ export function useBucketObjects(bucketName: string | null, currentPath: string
|
||||
|
||||
try {
|
||||
const dirKey = currentPath ? `${currentPath}${dirName}/` : `${dirName}/`;
|
||||
await objectsApi.upload(bucketName, dirKey, new File([], '.keep'));
|
||||
await objectsApi.createDirectory(bucketName, dirKey);
|
||||
toast.success(`Directory "${dirName}" created successfully`);
|
||||
await fetchObjects(currentContinuationToken, true);
|
||||
return true;
|
||||
|
||||
@@ -276,6 +276,10 @@ export const objectsApi = {
|
||||
};
|
||||
},
|
||||
|
||||
createDirectory: async (bucket: string, key: string): Promise<void> => {
|
||||
await api.post(`/v1/buckets/${bucket}/directories`, { key });
|
||||
},
|
||||
|
||||
upload: async (bucket: string, key: string, file: File, onProgress?: (progress: number) => void): Promise<void> => {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
|
||||
Reference in New Issue
Block a user