diff --git a/components/common/ErrorMessage.js b/components/common/ErrorMessage.js index 5747f226..b8b0b2ad 100644 --- a/components/common/ErrorMessage.js +++ b/components/common/ErrorMessage.js @@ -1,14 +1,27 @@ import React from 'react'; +import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import Icon from './Icon'; import Exclamation from 'assets/exclamation-triangle.svg'; import styles from './ErrorMessage.module.css'; -export default function ErrorMessage() { +const DEFAULT_ID = 'message.failure'; +const DEFAULT_MESSAGE = 'Something went wrong'; + +function ErrorMessage({ error }) { + const [id, defaultMessage] = + typeof error === 'string' ? error.split('\t') : [DEFAULT_ID, DEFAULT_MESSAGE]; + return (