mirror of
https://github.com/vale981/Vulcan
synced 2025-03-09 12:16:37 -04:00

Added `error.properties` to follow fae7b5a032
.
Kept `error.data` for backwards compatibility, not sure that it's needed. If it is, it might be good to add it to FormErrors too
21 lines
647 B
JavaScript
21 lines
647 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { registerComponent } from 'meteor/vulcan:core';
|
|
import { FormattedMessage } from 'meteor/vulcan:i18n';
|
|
|
|
const FieldErrors = ({ errors }) => (
|
|
<ul className="form-input-errors">
|
|
{errors.map((error, index) => (
|
|
<li key={index}>
|
|
{error.message || (
|
|
<FormattedMessage
|
|
id={error.id}
|
|
values={{ ...error.data, ...error.properties }} //keep data for backwards compatibility ?
|
|
defaultMessage={JSON.stringify(error)}
|
|
/>
|
|
)}
|
|
</li>
|
|
))}
|
|
</ul>
|
|
);
|
|
registerComponent('FieldErrors', FieldErrors);
|