Skip to content

Commit

Permalink
Parse visit count correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejmatu committed Aug 8, 2018
1 parent 091c36e commit b7a5a76
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/components/PageCounter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react'
import style from './style.scss';

function PageCounter({ visitCount }) {
console.log(visitCount);
if (!visitCount) return null;

return (
Expand Down
8 changes: 3 additions & 5 deletions src/layouts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import './index.scss'

class TemplateWrapper extends React.Component {
state = {
visitCount: null,
noDbConnection: false
visitCount: null
}

componentDidMount() {
Expand All @@ -18,10 +17,9 @@ class TemplateWrapper extends React.Component {
return Promise.reject('No db connection')
}

const data = res.json()

this.setState({ visitCount: res.data.value.requests })
return res.json();
})
.then((data) => this.setState({ visitCount: data.value.requests }))
.catch(console.warn);
}

Expand Down

0 comments on commit b7a5a76

Please sign in to comment.