analytics/assets/js/dashboard/mount.js

28 lines
662 B
JavaScript
Raw Normal View History

import React from 'react';
import ReactDOM from 'react-dom';
import 'url-search-params-polyfill';
import Router from './router'
2020-07-15 12:14:53 +03:00
import ErrorBoundary from './error-boundary'
const container = document.getElementById('stats-react-container')
if (container) {
const site = {
domain: container.dataset.domain,
offset: container.dataset.offset,
hasGoals: container.dataset.hasGoals === 'true',
insertedAt: container.dataset.insertedAt
}
const loggedIn = container.dataset.loggedIn === 'true'
2020-07-15 12:14:53 +03:00
const app = (
<ErrorBoundary>
<Router site={site} loggedIn={loggedIn} />
2020-07-15 12:14:53 +03:00
</ErrorBoundary>
)
ReactDOM.render(app, container);
}