Refactor: 쿼리 단순화
This commit is contained in:
parent
9098694d99
commit
1c9bd12f1b
@ -1,20 +1,10 @@
|
|||||||
import { uploadImageFolderFile } from '@/api/imageApi';
|
import { uploadImageFolderFile } from '@/api/imageApi';
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
|
import { UploadFolderParams } from '@/types/uploadTypes';
|
||||||
|
|
||||||
export default function useUploadImageFolderFileQuery() {
|
export default function useUploadImageFolderFileQuery() {
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: ({
|
mutationFn: ({ memberId, projectId, folderId, files, progressCallback }: UploadFolderParams) =>
|
||||||
memberId,
|
uploadImageFolderFile(memberId, projectId, folderId, files, progressCallback),
|
||||||
projectId,
|
|
||||||
folderId,
|
|
||||||
files,
|
|
||||||
progressCallback,
|
|
||||||
}: {
|
|
||||||
memberId: number;
|
|
||||||
projectId: number;
|
|
||||||
folderId: number;
|
|
||||||
files: File[];
|
|
||||||
progressCallback: (progress: number) => void;
|
|
||||||
}) => uploadImageFolderFile(memberId, projectId, folderId, files, progressCallback),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,10 @@
|
|||||||
import { uploadImageZip } from '@/api/imageApi';
|
import { uploadImageZip } from '@/api/imageApi';
|
||||||
import { useMutation } from '@tanstack/react-query';
|
import { useMutation } from '@tanstack/react-query';
|
||||||
|
import { UploadZipParams } from '@/types/uploadTypes';
|
||||||
|
|
||||||
export default function useUploadImageZipQuery() {
|
export default function useUploadImageZipQuery() {
|
||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: ({
|
mutationFn: ({ memberId, projectId, folderId, file, progressCallback }: UploadZipParams) =>
|
||||||
memberId,
|
uploadImageZip(memberId, projectId, folderId, file, progressCallback),
|
||||||
projectId,
|
|
||||||
folderId,
|
|
||||||
file,
|
|
||||||
progressCallback,
|
|
||||||
}: {
|
|
||||||
memberId: number;
|
|
||||||
projectId: number;
|
|
||||||
folderId: number;
|
|
||||||
file: File;
|
|
||||||
progressCallback: (progress: number) => void;
|
|
||||||
}) => uploadImageZip(memberId, projectId, folderId, file, progressCallback),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user