Skip to content

Instantly share code, notes, and snippets.

@nomoney4me
Created October 30, 2018 21:53
Show Gist options
  • Select an option

  • Save nomoney4me/1194390a602606967b87bc39197e8370 to your computer and use it in GitHub Desktop.

Select an option

Save nomoney4me/1194390a602606967b87bc39197e8370 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react'
import { Row, Col } from 'reactstrap';
import TotalCount from './widgets/TotalCounts';
import PivotWidget from './PivotWidget';
import BarGraph from './BarGraph';
import CustomTable from './CustomTable';
import DemoTable from './DemoTable';
import Loading from '../assets/img/loading.gif';
export default class Dashboard extends Component {
constructor(props) {
super(props)
this.state = {
sql_data: null,
list_data: null
}
}
componentWillMount() {
fetch(`/api/get_counts`)
.then(res => res.json()).then(data => {
console.log(data)
this.setState({ sql_data: data })
}, [])
}
render() {
return (
<Row>
<Col xs={6} md={6} lg={6}>
{ this.state.sql_data ? <DemoTable data={ this.state.sql_data } /> : <img src={Loading} /> }
<hr />
{ this.state.sql_data ? <DemoTable data={ this.state.sql_data } /> : <img src={Loading} /> }
</Col>
<Col xs={6} md={6} lg={6}>
{ this.state.sql_data ? <BarGraph data={this.state.sql_data} /> : <img src={Loading} /> }
</Col>
</Row>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment