mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
don't restart when upload error happens
This commit is contained in:
@@ -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');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ export default () => {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
res.statusCode = 400;
|
res.statusCode = 406;
|
||||||
console.log('Invalid file extension!');
|
console.log('Invalid file extension!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user