Refactor: 쿼리 단순화

This commit is contained in:
정현조 2024-10-05 13:40:20 +09:00
parent 9098694d99
commit 1c9bd12f1b
2 changed files with 6 additions and 26 deletions

View File

@ -1,20 +1,10 @@
import { uploadImageFolderFile } from '@/api/imageApi';
import { useMutation } from '@tanstack/react-query';
import { UploadFolderParams } from '@/types/uploadTypes';
export default function useUploadImageFolderFileQuery() {
return useMutation({
mutationFn: ({
memberId,
projectId,
folderId,
files,
progressCallback,
}: {
memberId: number;
projectId: number;
folderId: number;
files: File[];
progressCallback: (progress: number) => void;
}) => uploadImageFolderFile(memberId, projectId, folderId, files, progressCallback),
mutationFn: ({ memberId, projectId, folderId, files, progressCallback }: UploadFolderParams) =>
uploadImageFolderFile(memberId, projectId, folderId, files, progressCallback),
});
}

View File

@ -1,20 +1,10 @@
import { uploadImageZip } from '@/api/imageApi';
import { useMutation } from '@tanstack/react-query';
import { UploadZipParams } from '@/types/uploadTypes';
export default function useUploadImageZipQuery() {
return useMutation({
mutationFn: ({
memberId,
projectId,
folderId,
file,
progressCallback,
}: {
memberId: number;
projectId: number;
folderId: number;
file: File;
progressCallback: (progress: number) => void;
}) => uploadImageZip(memberId, projectId, folderId, file, progressCallback),
mutationFn: ({ memberId, projectId, folderId, file, progressCallback }: UploadZipParams) =>
uploadImageZip(memberId, projectId, folderId, file, progressCallback),
});
}