add web handle fetch error
This commit is contained in:
@@ -14,6 +14,9 @@ function FfmpegConfig(props) {
|
||||
if (data.ffmpeg_config_list.length > 0) {
|
||||
props.setSelectedFfmpegConfig(data.ffmpeg_config_list[0]);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
alert("get_ffmpeg_config_list error: " + error);
|
||||
});
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -10,8 +10,13 @@ function GetRandomFiles(props) {
|
||||
fetch("/api/v1/get_random_files")
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
setIsLoading(false);
|
||||
setFiles(data.files);
|
||||
})
|
||||
.catch((error) => {
|
||||
alert("get_random_files error: " + error);
|
||||
})
|
||||
.finally(() => {
|
||||
setIsLoading(false);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@ function Share(props) {
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
setFile([data]);
|
||||
})
|
||||
.catch((error) => {
|
||||
alert("get_file_info error: " + error);
|
||||
});
|
||||
}, [params]);
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user