fix(roles): show the correct error message (#7089)

This commit is contained in:
Pablo Lara
2025-03-03 15:46:02 +01:00
committed by GitHub
parent e5eccb6227
commit 2036a59210
+5 -6
View File
@@ -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;