Add APIErrorsNotice

This commit is contained in:
Amine Ben hammou
2019-06-28 18:37:25 +01:00
committed by M. Shull
parent b18804fa6e
commit aebaed7c99

View 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;