added more hooks
This commit is contained in:
@@ -11,6 +11,8 @@ interface QueryKeyParams {
|
||||
startAt?: boolean;
|
||||
}
|
||||
|
||||
// GET
|
||||
|
||||
export const getFilesList = async ({
|
||||
queryKey,
|
||||
pageParam,
|
||||
@@ -47,3 +49,36 @@ export const getQuickFilesList = async () => {
|
||||
});
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const getFileThumbnail = async (thumbnailID: string) => {
|
||||
const url = `http://localhost:5173/api/file-service/thumbnail/${thumbnailID}`;
|
||||
const config = {
|
||||
responseType: "arraybuffer",
|
||||
};
|
||||
|
||||
const response = await axios.get(url, config);
|
||||
|
||||
const imgFile = new Blob([response.data]);
|
||||
const imgUrl = URL.createObjectURL(imgFile);
|
||||
|
||||
return imgUrl;
|
||||
};
|
||||
|
||||
// PATCH
|
||||
export const renameFile = async (fileID: string, name: string) => {
|
||||
const response = await axios.patch(`/file-service/rename`, {
|
||||
id: fileID,
|
||||
title: name,
|
||||
});
|
||||
return response.data;
|
||||
};
|
||||
|
||||
// DELETE
|
||||
export const deleteFile = async (fileID: string) => {
|
||||
const response = await axios.delete(`/file-service/remove`, {
|
||||
data: {
|
||||
id: fileID,
|
||||
},
|
||||
});
|
||||
return response.data;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user