Files
SCM-Manager/scm-ui/src/components/ErrorNotification.js

26 lines
550 B
JavaScript
Raw Normal View History

2018-07-11 21:01:29 +02:00
//@flow
import React from "react";
import { translate } from "react-i18next";
2018-07-11 21:01:29 +02:00
import Notification from "./Notification";
type Props = {
t: string => string,
2018-07-13 10:57:11 +02:00
error?: Error
2018-07-11 21:01:29 +02:00
};
class ErrorNotification extends React.Component<Props> {
render() {
const { t, error } = this.props;
2018-07-11 21:01:29 +02:00
if (error) {
return (
<Notification type="danger">
<strong>{t("error-notification.prefix")}:</strong> {error.message}
2018-07-11 21:01:29 +02:00
</Notification>
);
}
return "";
}
}
export default translate("commons")(ErrorNotification);