diff --git a/src/components/Receipt/ReceiptList/List.js b/src/components/Receipt/ReceiptList/List.js index 5649d29..c0f01ee 100644 --- a/src/components/Receipt/ReceiptList/List.js +++ b/src/components/Receipt/ReceiptList/List.js @@ -65,14 +65,14 @@ export class List extends React.Component { } getTagName = (tagId) => { - if(this.props.tags) + if(!(this.props.tags === undefined || this.props.tags.length == 0)) return this.props.tags[tagId - 1].category else return 'carregando...' } getTagColor = (tagId) => { - if(this.props.tags) + if(!(this.props.tags === undefined || this.props.tags.length == 0)) return this.props.tags[tagId - 1].color else return '#424242' @@ -93,9 +93,9 @@ export class List extends React.Component { } export const mapStateToProps = state => { return { - tags: state.tags + tags: state.tags, + receipts: state.receipts } } export default connect(mapStateToProps)(List) - diff --git a/src/components/Receipt/ReceiptList/ReceiptList.js b/src/components/Receipt/ReceiptList/ReceiptList.js index eb549fc..22215d7 100644 --- a/src/components/Receipt/ReceiptList/ReceiptList.js +++ b/src/components/Receipt/ReceiptList/ReceiptList.js @@ -10,19 +10,19 @@ import getAllTags from '../../../services/getAllTags' const smallDevice = window.matchMedia('(max-width: 800px)').matches export class ReceiptList extends Component { state = { - loaded: false, + receiptsLoaded: false, + tagsLoaded: false, } componentDidMount() { - this.fetchReceipts() this.fetchTags() + this.fetchReceipts() } render() { return (