Skip to content

Commit

Permalink
fix: redirect to the users list view on successful deletion from the …
Browse files Browse the repository at this point in the history
…profile view

SH Admin dashboard
  • Loading branch information
jamesgeorge007 committed Mar 28, 2024
1 parent 1f7a8ed commit 787aab6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
16 changes: 5 additions & 11 deletions packages/hoppscotch-sh-admin/src/helpers/userManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 2 additions & 1 deletion packages/hoppscotch-sh-admin/src/pages/users/_id.vue
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,14 @@ 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 || [];
handleUserDeletion(deletedUsers);
}
confirmDeletion.value = false;
deleteUserUID.value = null;
!result.error && router.push('/users');
};
</script>

0 comments on commit 787aab6

Please sign in to comment.