add web handle fetch error

This commit is contained in:
2021-11-24 11:09:21 +08:00
parent 8a2c8dd8b2
commit e3de41fe07
5 changed files with 24 additions and 3 deletions

View File

@@ -32,9 +32,14 @@ function SearchFiles(props) {
})
.then((response) => response.json())
.then((data) => {
setIsLoading(false);
const files = data.files ? data.files : [];
setFiles(files);
})
.catch((error) => {
alert("get_files_in_folder error: " + error);
})
.finally(() => {
setIsLoading(false);
});
}