1 import PropTypes from 'prop-types';
2 import React from 'react';
3 import { Alert } from 'react-bootstrap';
4 import { withTranslation } from 'react-i18next';
6 import i18n from '../../i18n';
8 const ErrorMessage = ({ error }) => {
10 return <Alert variant="danger">
11 <Alert.Heading>{i18n.t(`error.${error.response.status}.heading`)}</Alert.Heading>
12 <p className="mb-0">{i18n.t(`error.${error.response.status}.description`)}</p>
16 return <Alert variant="danger">
17 <Alert.Heading>Error</Alert.Heading>
18 <p className="mb-0">{error.message}</p>
21 return <div className="error">Error</div>;
24 ErrorMessage.propTypes = {
25 error: PropTypes.shape({
26 message: PropTypes.string,
27 request: PropTypes.shape({}),
28 response: PropTypes.shape({
29 status: PropTypes.number,
34 export default withTranslation()(ErrorMessage);