mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
don't restart when upload error happens
This commit is contained in:
@@ -44,7 +44,7 @@ const SingleUpload = ({ doRestart }) => {
|
||||
abort: cancelUpload
|
||||
} = useRequest(SystemApi.uploadFile, {
|
||||
immediate: false
|
||||
}).onComplete(({ data }) => {
|
||||
}).onSuccess(({ data }) => {
|
||||
if (data) {
|
||||
setMd5(data.md5 as string);
|
||||
toast.success(LL.UPLOAD() + ' MD5 ' + LL.SUCCESSFUL());
|
||||
@@ -59,10 +59,8 @@ const SingleUpload = ({ doRestart }) => {
|
||||
await sendUpload(file).catch((error: Error) => {
|
||||
if (error.message === 'The user aborted a request') {
|
||||
toast.warning(LL.UPLOAD() + ' ' + LL.ABORTED());
|
||||
} else if (error.message === 'Network Error') {
|
||||
toast.warning('Invalid file extension or incompatible bin file');
|
||||
} else {
|
||||
toast.error(error.message);
|
||||
toast.warning('Invalid file extension or incompatible bin file');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ export default () => {
|
||||
})
|
||||
);
|
||||
} else {
|
||||
res.statusCode = 400;
|
||||
res.statusCode = 406;
|
||||
console.log('Invalid file extension!');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user