From 787aab650ff584f9d9cd86aea8935c74b72bc632 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Thu, 28 Mar 2024 21:20:48 +0530 Subject: [PATCH] fix: redirect to the users list view on successful deletion from the profile view SH Admin dashboard --- .../src/helpers/userManagement.ts | 16 +++++----------- .../hoppscotch-sh-admin/src/pages/users/_id.vue | 3 ++- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/packages/hoppscotch-sh-admin/src/helpers/userManagement.ts b/packages/hoppscotch-sh-admin/src/helpers/userManagement.ts index 605602cb7..f2865d450 100644 --- a/packages/hoppscotch-sh-admin/src/helpers/userManagement.ts +++ b/packages/hoppscotch-sh-admin/src/helpers/userManagement.ts @@ -40,17 +40,11 @@ export const handleUserDeletion = (deletedUsersList: UserDeletionResult[]) => { // Show the success toast based on the action type if there are no errors if (uniqueErrorMessages.size === 0) { - if (isBulkAction) { - toast.success( - isBulkAction - ? t('state.delete_user_success') - : t('state.delete_users_success') - ); - - return; - } - - toast.success(t('state.delete_user_success')); + toast.success( + isBulkAction + ? t('state.delete_users_success') + : t('state.delete_user_success') + ); return; } diff --git a/packages/hoppscotch-sh-admin/src/pages/users/_id.vue b/packages/hoppscotch-sh-admin/src/pages/users/_id.vue index 05b22059d..4bd9700d6 100644 --- a/packages/hoppscotch-sh-admin/src/pages/users/_id.vue +++ b/packages/hoppscotch-sh-admin/src/pages/users/_id.vue @@ -207,7 +207,6 @@ const deleteUserMutation = async (id: string | null) => { if (result.error) { toast.error(t('state.delete_user_failure')); - router.push('/users'); } else { const deletedUsers = result.data?.removeUsersByAdmin || []; @@ -215,5 +214,7 @@ const deleteUserMutation = async (id: string | null) => { } confirmDeletion.value = false; deleteUserUID.value = null; + + !result.error && router.push('/users'); };