don't restart when upload error happens

This commit is contained in:
proddy
2024-09-11 14:59:27 +02:00
parent 5f1877f995
commit 5fc82c72f4
2 changed files with 3 additions and 5 deletions

View File

@@ -44,7 +44,7 @@ const SingleUpload = ({ doRestart }) => {
abort: cancelUpload abort: cancelUpload
} = useRequest(SystemApi.uploadFile, { } = useRequest(SystemApi.uploadFile, {
immediate: false immediate: false
}).onComplete(({ data }) => { }).onSuccess(({ data }) => {
if (data) { if (data) {
setMd5(data.md5 as string); setMd5(data.md5 as string);
toast.success(LL.UPLOAD() + ' MD5 ' + LL.SUCCESSFUL()); toast.success(LL.UPLOAD() + ' MD5 ' + LL.SUCCESSFUL());
@@ -59,10 +59,8 @@ const SingleUpload = ({ doRestart }) => {
await sendUpload(file).catch((error: Error) => { await sendUpload(file).catch((error: Error) => {
if (error.message === 'The user aborted a request') { if (error.message === 'The user aborted a request') {
toast.warning(LL.UPLOAD() + ' ' + LL.ABORTED()); toast.warning(LL.UPLOAD() + ' ' + LL.ABORTED());
} else if (error.message === 'Network Error') {
toast.warning('Invalid file extension or incompatible bin file');
} else { } else {
toast.error(error.message); toast.warning('Invalid file extension or incompatible bin file');
} }
}); });
} }

View File

@@ -84,7 +84,7 @@ export default () => {
}) })
); );
} else { } else {
res.statusCode = 400; res.statusCode = 406;
console.log('Invalid file extension!'); console.log('Invalid file extension!');
} }
} }