Add APIErrorsNotice
This commit is contained in:
committed by
M. Shull
parent
b18804fa6e
commit
aebaed7c99
15
assets/js/src/notices/api_errors_notice.jsx
Normal file
15
assets/js/src/notices/api_errors_notice.jsx
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import Notice from 'notices/notice.jsx';
|
||||||
|
|
||||||
|
const APIErrorsNotice = ({ errors }) => {
|
||||||
|
if (errors.length < 1) return null;
|
||||||
|
return <Notice type="error">{errors.map(err => <p key={err.message}>{err.message}</p>)}</Notice>;
|
||||||
|
};
|
||||||
|
APIErrorsNotice.propTypes = {
|
||||||
|
errors: PropTypes.arrayOf(PropTypes.shape({
|
||||||
|
message: PropTypes.string.isRequired,
|
||||||
|
})).isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default APIErrorsNotice;
|
Reference in New Issue
Block a user