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

@@ -27,7 +27,6 @@ function SearchFolders(props) {
})
.then((response) => response.json())
.then((data) => {
setIsLoading(false);
let folders;
if (data.folders) {
folders = data.folders;
@@ -35,6 +34,12 @@ function SearchFolders(props) {
folders = [];
}
setFolders(folders);
})
.catch((error) => {
alert("search_folders error: " + error);
})
.finally(() => {
setIsLoading(false);
});
}