pass period to table component

This commit is contained in:
Danny 2018-05-01 16:10:39 +02:00
parent 8137f10fbc
commit 399c486209
2 changed files with 3 additions and 3 deletions

View File

@ -25,7 +25,6 @@ class CountWidget extends Component {
} }
componentWillReceiveProps(newProps) { componentWillReceiveProps(newProps) {
console.log(newProps);
if(this.props.period != newProps.period) { if(this.props.period != newProps.period) {
this.fetchData(newProps.period) this.fetchData(newProps.period)
} }
@ -36,6 +35,7 @@ class CountWidget extends Component {
let before, after; let before, after;
let afterDate = new Date(); let afterDate = new Date();
afterDate.setHours(0, 0, 0, 0); afterDate.setHours(0, 0, 0, 0);
switch(period) { switch(period) {
case "week": case "week":
afterDate.setDate(afterDate.getDate() - (afterDate.getDay() + 6) % 7); afterDate.setDate(afterDate.getDate() - (afterDate.getDay() + 6) % 7);

View File

@ -52,8 +52,8 @@ class Dashboard extends Component {
<CountWidget title="Bounce rate" endpoint="bounce-rate" format="percentage" period={state.period} /> <CountWidget title="Bounce rate" endpoint="bounce-rate" format="percentage" period={state.period} />
</div> </div>
<Table endpoint="pageviews" headers={["Top pages", "Views", "Uniques"]} /> <Table endpoint="pageviews" headers={["Top pages", "Views", "Uniques"]} period={state.period} />
<Table endpoint="referrers" headers={["Top referrers", "Views", "Uniques"]} /> <Table endpoint="referrers" headers={["Top referrers", "Views", "Uniques"]} period={state.period} />
</div> </div>
</section> </section>