fix(api): throw errors for all non-ok responses (#8880)

This commit is contained in:
Alan Buscaglia
2025-10-10 10:47:04 +02:00
committed by GitHub
parent 1483efa18e
commit ef60ea99c3
3 changed files with 17 additions and 5 deletions

View File

@@ -28,6 +28,7 @@ All notable changes to the **Prowler UI** are documented in this file.
### 🐞 Fixed
- SAML configuration errors are now properly caught and displayed [(#8880)](https://github.com/prowler-cloud/prowler/pull/8880)
- ThreatScore for each pillar in Prowler ThreatScore specific view [(#8582)](https://github.com/prowler-cloud/prowler/pull/8582)
---

View File

@@ -40,7 +40,18 @@ export const createSamlConfig = async (_prevState: any, formData: FormData) => {
}),
});
await handleApiResponse(response, "/integrations", false);
const result = await handleApiResponse(response, "/integrations", false);
if (result.error) {
return {
errors: {
general:
result.error instanceof Error
? result.error.message
: "Error creating SAML configuration. Please try again.",
},
};
}
return { success: "SAML configuration created successfully!" };
} catch (error) {
console.error("Error creating SAML config:", error);

View File

@@ -75,7 +75,7 @@ const baseAuthSchema = z.object({
export const signInSchema = baseAuthSchema
.extend({
password: z.string().min(1, { message: "Password is required." }),
password: z.string(),
})
.refine(
(data) => {