import React from 'react'; import { Modal, Button } from 'react-bootstrap'; import { ERROR } from './actions'; import { app } from './app'; /** * Standard view of application errors */ export default class ErrorView extends React.Component { constructor(props) { super(props); this._onAppChange = this._onAppChange.bind(this); this.close = this.close.bind(this); } componentDidMount() { app.add(this._onAppChange); } componentWillUmount() { app.remove(this._onAppChange); } /** * Called when application state changes * @param {[type]} action [description] * @return {[type]} [description] */ _onAppChange(action, data) { if (action === ERROR) { this.setState(data); } } /** * Called to close the error message */ close() { // clean up the error message this.setState({ error: null }); } render() { const err = this.state ? this.state.error : null; const show = err !== null; return (

{__('error.title')}

{__('error.msg1')}

{__('form.reason') + ': '}{err}

); } }