From da06195d08a29840a33cd2f1625bcd1dd9156a80 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Sun, 25 Dec 2022 13:04:31 +0800 Subject: [PATCH] perf: automatic refresh of the list of users and roles (#797) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind improvement /milestone 2.1.x #### What this PR does / why we need it: 优化用户和角色列表,如果包含正在删除的内容会自动刷新。 #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/3036 #### Special notes for your reviewer: 测试方式: 1. 创建若干角色和用户。 2. 测试删除之后是否会自动刷新列表。 #### Does this PR introduce a user-facing change? ```release-note 优化 Console 端的用户和角色列表,如果包含正在删除的内容会自动刷新。 ``` --- src/modules/system/roles/RoleList.vue | 12 +++++---- .../system/roles/composables/use-role.ts | 26 ++++++++++++++++--- src/modules/system/users/UserList.vue | 25 +++++++++++++++--- 3 files changed, 52 insertions(+), 11 deletions(-) diff --git a/src/modules/system/roles/RoleList.vue b/src/modules/system/roles/RoleList.vue index 16cfb2ab..a7da6169 100644 --- a/src/modules/system/roles/RoleList.vue +++ b/src/modules/system/roles/RoleList.vue @@ -137,6 +137,8 @@ const handleDelete = async (role: Role) => { Toast.success("删除成功"); } catch (e) { console.error("Failed to delete role", e); + } finally { + handleFetchRoles(); } }, }); @@ -296,11 +298,6 @@ const handleDelete = async (role: Role) => { > + + +