diff --git a/package.json b/package.json index fd3b3c6..2ef1d5b 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "author": { "name": "YuYang", "email": "liuyuyang1024@yeah.net", - "url": "https://blog.liuyuyang.net" + "url": "https://liuyuyang.net" }, "dependencies": { "@bytemd/plugin-gemoji": "^1.21.0", diff --git a/src/pages/Article/index.tsx b/src/pages/Article/index.tsx index b518b74..fbeac10 100644 --- a/src/pages/Article/index.tsx +++ b/src/pages/Article/index.tsx @@ -39,14 +39,17 @@ const ArticlePage = () => { const delArticleData = async (id: number) => { setLoading(true); - // 普通删除:可从回收站恢复 - await delArticleDataAPI(id, true); - await getArticleList(); - form.resetFields() - setCurrent(1) - notification.success({ message: '🎉 删除文章成功' }) - - setLoading(false); + try { + // 普通删除:可从回收站恢复 + await delArticleDataAPI(id, true); + await getArticleList(); + form.resetFields() + setCurrent(1) + notification.success({ message: '🎉 删除文章成功' }) + setLoading(false); + } catch (error) { + setLoading(false); + } }; // 标签颜色 diff --git a/src/pages/Cate/index.tsx b/src/pages/Cate/index.tsx index b5c8c98..3cb4ac9 100644 --- a/src/pages/Cate/index.tsx +++ b/src/pages/Cate/index.tsx @@ -20,7 +20,7 @@ const CatePage = () => { const getCateList = async () => { const { data } = await getCateListAPI(); data.sort((a, b) => a.order - b.order) - + setList(data as Cate[]); setLoading(false); }; @@ -55,9 +55,13 @@ const CatePage = () => { const delCateData = async (id: number) => { setLoading(true); - await delCateDataAPI(id); - message.success('🎉 删除分类成功'); - getCateList(); + try { + await delCateDataAPI(id); + message.success('🎉 删除分类成功'); + getCateList(); + } catch (error) { + setLoading(false); + } }; const submit = async () => { diff --git a/src/pages/Create/components/PublishForm/index.tsx b/src/pages/Create/components/PublishForm/index.tsx index 4ac2170..a21cdf1 100644 --- a/src/pages/Create/components/PublishForm/index.tsx +++ b/src/pages/Create/components/PublishForm/index.tsx @@ -149,7 +149,7 @@ const PublishForm = ({ data, closeModel }: { data: Article, closeModel: () => vo ...values, content: data.content, tagIds: tagIds.join(','), - isDraft: 0, + isDraft: isDraft ? 1 : 0, config: { status: values.status, password: values.password @@ -249,9 +249,9 @@ const PublishForm = ({ data, closeModel }: { data: Article, closeModel: () => vo {/* 草稿和编辑状态下不再显示保存草稿按钮 */} - {(!isDraftParams && !id) && ( + {((isDraftParams && id) || !id) && (