diff --git a/sau_web_react/src/pages/Account/index.tsx b/sau_web_react/src/pages/Account/index.tsx index 7666cde..e884dee 100644 --- a/sau_web_react/src/pages/Account/index.tsx +++ b/sau_web_react/src/pages/Account/index.tsx @@ -79,7 +79,11 @@ const Account = () => { }); }, [accounts, filterPlatform, searchKeyword]); - const refresh = () => dispatch(loadAccounts()); + const refresh = () => { + dispatch(loadAccounts()).catch(() => { + // 刷新失败不阻塞,列表保持现状 + }); + }; const startCheck = async (ids: number[]) => { if (!ids.length) { @@ -126,7 +130,7 @@ const Account = () => { MessagePlugin.warning('请先选择账号'); return; } - DialogPlugin.confirm({ + const dialog = DialogPlugin.confirm({ header: '批量删除', body: '确定删除选中的 ' + selectedRowKeys.length + ' 个账号?对应 Cookie 文件也会被删除。', confirmBtn: { content: '删除', theme: 'danger' }, @@ -138,13 +142,15 @@ const Account = () => { refresh(); } catch { MessagePlugin.error('删除失败'); + } finally { + dialog.hide(); } }, }); }; const onDelete = (row: IAccount) => { - DialogPlugin.confirm({ + const dialog = DialogPlugin.confirm({ header: '删除账号', body: '确定删除账号「' + row.name + '」?对应 Cookie 文件也会被删除。', confirmBtn: { content: '删除', theme: 'danger' }, @@ -155,6 +161,8 @@ const Account = () => { refresh(); } catch { MessagePlugin.error('删除失败'); + } finally { + dialog.hide(); } }, }); diff --git a/sau_web_react/src/pages/ApiDocs/index.tsx b/sau_web_react/src/pages/ApiDocs/index.tsx index e83feb8..13e7bed 100644 --- a/sau_web_react/src/pages/ApiDocs/index.tsx +++ b/sau_web_react/src/pages/ApiDocs/index.tsx @@ -153,7 +153,7 @@ const ApiDocs = () => { }; const onDeleteKey = (row: IApiKey) => { - DialogPlugin.confirm({ + const dialog = DialogPlugin.confirm({ header: '删除密钥', body: '删除后使用该密钥的外部系统将无法调用 API,确定删除?', confirmBtn: { content: '删除', theme: 'danger' }, @@ -164,6 +164,8 @@ const ApiDocs = () => { loadKeys(); } catch { MessagePlugin.error('删除失败'); + } finally { + dialog.hide(); } }, }); diff --git a/sau_web_react/src/pages/Material/index.tsx b/sau_web_react/src/pages/Material/index.tsx index 22b494f..60a047d 100644 --- a/sau_web_react/src/pages/Material/index.tsx +++ b/sau_web_react/src/pages/Material/index.tsx @@ -36,7 +36,11 @@ const Material = () => { dispatch(loadMaterials()); }, [dispatch]); - const refresh = () => dispatch(loadMaterials()); + const refresh = () => { + dispatch(loadMaterials()).catch(() => { + // 刷新失败不阻塞,列表保持现状 + }); + }; const onPickFiles = () => { fileInputRef.current?.click(); @@ -63,7 +67,7 @@ const Material = () => { }; const onDelete = (row: IMaterial) => { - DialogPlugin.confirm({ + const dialog = DialogPlugin.confirm({ header: '删除素材', body: '确定删除素材「' + row.filename + '」?', confirmBtn: { content: '删除', theme: 'danger' }, @@ -74,6 +78,8 @@ const Material = () => { refresh(); } catch { MessagePlugin.error('删除失败'); + } finally { + dialog.hide(); } }, });