diff --git a/src/components/BuildingListTable/index.js b/src/components/BuildingListTable/index.js index fcd39ef1d1b50974b7c8f1b61afcdc843be7014e..cfa857e89514c79795085cd254c1f618d90b0884 100644 --- a/src/components/BuildingListTable/index.js +++ b/src/components/BuildingListTable/index.js @@ -1,6 +1,7 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; import { browserHistory } from 'react-router'; import './styles.css'; +import { buildingList, loadErrorPropTypes } from '../../containers/SearchBar/propTypes'; export default function BuildingListTable({ buildings, error }) { if (error) { @@ -54,17 +55,6 @@ export default function BuildingListTable({ buildings, error }) { } BuildingListTable.propTypes = { - buildings: PropTypes.arrayOf(PropTypes.shape({ - address: PropTypes.state, - bbl: PropTypes.number, - bin_id: PropTypes.number, - building_id: PropTypes.number, - lot_id: PropTypes.number, - borough: PropTypes.string, - zipcode: PropTypes.number, - })), - error: PropTypes.oneOfType([ - PropTypes.instanceOf(Error), - PropTypes.bool, - ]), + buildings: buildingList, + error: loadErrorPropTypes.error, }; diff --git a/src/components/ErrorAlert/index.js b/src/components/ErrorAlert/index.js index c0862b7e421033cc037f9b0ce2098d9f45a4905c..87d606aaf9ca9c134714ee9a572678b70c6c1883 100644 --- a/src/components/ErrorAlert/index.js +++ b/src/components/ErrorAlert/index.js @@ -1,24 +1,39 @@ -import React, { PropTypes } from 'react'; +import React, { Component, PropTypes } from 'react'; -const ErrorAlert = (props) => { - const { error, genericMessage } = props; - let errMessage = ''; - if (error && genericMessage !== undefined) { - errMessage = `${genericMessage} | ${error.message}`; - } else if (error) { - errMessage = error.message; +class ErrorAlert extends Component { + constructor(props) { + super(props); + + this.state = { + errMessage: '', + }; } - return ( -
{genericMessage}
+{this.state.errMessage}
+Loading...