重构前端错误提示

This commit is contained in:
whyour
2022-09-22 23:59:23 +08:00
parent e274d3e2f9
commit f2fea47336
33 changed files with 347 additions and 363 deletions
+9 -5
View File
@@ -54,9 +54,11 @@ const Log = () => {
setLoading(true);
request
.get(`${config.apiPrefix}logs`)
.then((data) => {
setData(data.data);
setFilterData(data.data);
.then(({ code, data }) => {
if (code === 200) {
setData(data);
setFilterData(data);
}
})
.finally(() => setLoading(false));
};
@@ -64,8 +66,10 @@ const Log = () => {
const getLog = (node: any) => {
request
.get(`${config.apiPrefix}logs/${node.title}?path=${node.parent || ''}`)
.then((data) => {
setValue(data.data);
.then(({ code, data }) => {
if (code === 200) {
setValue(data);
}
});
};