fix(views): Fix view tracking

This commit is contained in:
Stuart Taylor
2018-08-03 15:40:55 +01:00
committed by mrugesh mohapatra
parent ed7aa8f074
commit 993958daea

View File

@ -97,13 +97,13 @@ class ShowArticle extends Component {
if (username && !slug) { if (username && !slug) {
return history.push('/'); return history.push('/');
} }
const [, shortId] = slug.split('--');
postPopularityEvent({
event: 'view',
timestamp: Date.now(),
shortId
});
if (article) { if (article) {
const [, shortId] = slug.split('--');
postPopularityEvent({
event: 'view',
timestamp: Date.now(),
shortId
});
/* eslint-disable react/no-did-mount-set-state */ /* eslint-disable react/no-did-mount-set-state */
return this.setState( return this.setState(
{ {