Add optional i18n keys for violations and make path optional

This commit is contained in:
Rene Pfeuffer
2020-01-15 17:38:11 +01:00
parent fca59fb28c
commit 53403f26e2
2 changed files with 5 additions and 3 deletions

View File

@@ -56,7 +56,8 @@ class BackendErrorNotification extends React.Component<Props> {
{error.violations.map((violation, index) => {
return (
<li key={index}>
<strong>{violation.path}:</strong> {violation.message}
{violation.path && <strong>{violation.path}:</strong>} {violation.message}{" "}
{violation.key && t(violation.key)}
</li>
);
})}

View File

@@ -2,9 +2,10 @@ type Context = {
type: string;
id: string;
}[];
type Violation = {
path: string;
export type Violation = {
path?: string;
message: string;
key?: string;
};
export type BackendErrorContent = {