docbrown/app/javascript/packs/analyticsArticle.js
rhymes 55634ad68f Display stats for organization article (#3232)
There was a bug where the frontend was not passing the organization id to the backend, and thus the fetching of the stats failed for organization articles.

This also adds a bit of error handling for `fetch` API
2019-06-19 09:17:35 -04:00

13 lines
339 B
JavaScript

import initCharts from '../analytics/dashboard';
function initDashboardArticle() {
const article = document.getElementById('article');
const { articleId, organizationId } = article.dataset;
initCharts({ articleId, organizationId });
}
window.InstantClick.on('change', () => {
initDashboardArticle();
});
initDashboardArticle();