mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-09 23:12:06 -03:30
Translate the validation error returned from the backend
Closes #42182 Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
This commit is contained in:
parent
9804b53f3b
commit
9b526b0548
@ -1,7 +1,12 @@
|
||||
import RequiredActionConfigInfoRepresentation from "@keycloak/keycloak-admin-client/lib/defs/requiredActionConfigInfoRepresentation";
|
||||
import RequiredActionConfigRepresentation from "@keycloak/keycloak-admin-client/lib/defs/requiredActionConfigRepresentation";
|
||||
import type RequiredActionProviderRepresentation from "@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderRepresentation";
|
||||
import { useAlerts, useFetch } from "@keycloak/keycloak-ui-shared";
|
||||
import {
|
||||
isUserProfileError,
|
||||
setUserProfileServerError,
|
||||
useAlerts,
|
||||
useFetch,
|
||||
} from "@keycloak/keycloak-ui-shared";
|
||||
import {
|
||||
ActionGroup,
|
||||
AlertVariant,
|
||||
@ -90,7 +95,19 @@ export const RequiredActionConfigModal = ({
|
||||
addAlert(t("configSaveSuccess"), AlertVariant.success);
|
||||
onClose();
|
||||
} catch (error) {
|
||||
addError("configSaveError", error);
|
||||
if (isUserProfileError(error)) {
|
||||
setUserProfileServerError(
|
||||
error,
|
||||
(name: string | number, error: unknown) => {
|
||||
// TODO: Does not set set the error message to the field, yet.
|
||||
// Still, this will do all front end replacement and translation of keys.
|
||||
addError("configSaveError", (error as any).message);
|
||||
},
|
||||
t,
|
||||
);
|
||||
} else {
|
||||
addError("configSaveError", error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user