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>
15 return <div className="error">Error</div>;
18 ErrorMessage.propTypes = {
19 error: PropTypes.shape({
20 message: PropTypes.string,
21 request: PropTypes.shape({}),
22 response: PropTypes.shape({
23 status: PropTypes.number,
28 export default withTranslation()(ErrorMessage);