Skip to content

Commit

Permalink
fix(roles): show the correct error message (#7089)
Browse files Browse the repository at this point in the history
  • Loading branch information
paabloLC authored Mar 3, 2025
1 parent e5eccb6 commit 2036a59
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions ui/actions/users/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,11 @@ export const deleteUser = async (formData: FormData) => {
});

if (!response.ok) {
try {
const errorData = await response.json();
throw new Error(errorData?.message || "Failed to delete the user");
} catch {
throw new Error("Failed to delete the user");
}
// Parse error response
const errorData = await response.json();
return {
errors: errorData.errors || [{ detail: "Failed to delete the user" }],
};
}

let data = null;
Expand Down

0 comments on commit 2036a59

Please sign in to comment.