Refactor APIErrorsNotice to Typescript
[MAILPOET-2658]
This commit is contained in:
committed by
Jack Kitterhing
parent
25aec60bc9
commit
83f3729e37
@@ -3,7 +3,7 @@ import MailPoet from 'mailpoet';
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import { Link } from 'react-router-dom';
|
||||
import APIErrorsNotice from 'notices/api_errors_notice.jsx';
|
||||
import APIErrorsNotice from 'notices/api_errors_notice.tsx';
|
||||
|
||||
const QueuePropType = PropTypes.shape({
|
||||
status: PropTypes.string,
|
||||
|
@@ -1,15 +1,18 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { FC } from 'react';
|
||||
import PropTypes, { InferProps } from 'prop-types';
|
||||
import Notice from 'notices/notice.tsx';
|
||||
|
||||
const APIErrorsNotice = ({ errors }) => {
|
||||
if (errors.length < 1) return null;
|
||||
return <Notice type="error" closable={false}>{errors.map((err) => <p key={err.message}>{err.message}</p>)}</Notice>;
|
||||
};
|
||||
APIErrorsNotice.propTypes = {
|
||||
const propTypes = {
|
||||
errors: PropTypes.arrayOf(PropTypes.shape({
|
||||
message: PropTypes.string.isRequired,
|
||||
})).isRequired,
|
||||
};
|
||||
|
||||
const APIErrorsNotice: FC<InferProps<typeof propTypes>> = ({ errors }) => {
|
||||
if (errors.length < 1) return null;
|
||||
return <Notice type="error" closable={false}>{errors.map((err) => <p key={err.message}>{err.message}</p>)}</Notice>;
|
||||
};
|
||||
|
||||
APIErrorsNotice.propTypes = propTypes;
|
||||
|
||||
export default APIErrorsNotice;
|
Reference in New Issue
Block a user