[as] feat: 파일 업로드 에러 로직 수정
This commit is contained in:
@@ -87,12 +87,14 @@ function useTus(options: UseTusOptions = {}): UseTusReturn {
|
||||
|
||||
const uploadFileAsync = useCallback(
|
||||
(file: File, uploadOptions?: UploadFileOptions): Promise<string> => {
|
||||
if (!validateFileType(file)) {
|
||||
return Promise.reject(new Error("Invalid file type"));
|
||||
}
|
||||
|
||||
const fileKey = uploadOptions?.fileKey ?? getDefaultFileKey(file);
|
||||
|
||||
if (!validateFileType(file)) {
|
||||
const error = new Error("Invalid file type");
|
||||
options.onError?.(error, file, fileKey, null);
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
||||
setIsUploading((prev) => ({ ...prev, [fileKey]: true }));
|
||||
setProgress((prev) => ({ ...prev, [fileKey]: 0 }));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user