feat: add recursive remove directory option

This commit is contained in:
2024-08-21 07:34:10 +07:00
parent 7532c6330c
commit 145bf3f1a9
3 changed files with 66 additions and 6 deletions
+5 -2
View File
@@ -40,10 +40,13 @@ export const usePutObject = (
export const useDeleteObject = (
bucket: string,
options?: UseMutationOptions<any, Error, string>
options?: UseMutationOptions<any, Error, { key: string; recursive?: boolean }>
) => {
return useMutation({
mutationFn: (key) => api.delete(`/browse/${bucket}/${key}`),
mutationFn: (data) =>
api.delete(`/browse/${bucket}/${data.key}`, {
params: { recursive: data.recursive },
}),
...options,
});
};