docbrown/app/javascript/packs/history.jsx
rhymes 2bf54edb9c Pro: History (#3220)
* Add base history support

* Add tags and ranking and make it work

* Fix styling

* Add article title and text excerpt to the index

* Add pagination support

* Debounce the search to 300ms

* Show history only to pro users

* Use routing helpers instead of hardcoding

* Raise the page size to 100

* Remove console log

* A bit of regrouping
2019-06-18 14:58:24 -04:00

22 lines
525 B
JavaScript

import { h, render } from 'preact';
import { getUserDataAndCsrfToken } from '../chat/util';
import { History } from '../history/history';
function loadComponent() {
getUserDataAndCsrfToken().then(({ currentUser }) => {
const root = document.getElementById('history');
if (root) {
render(
<History availableTags={currentUser.followed_tag_names} />,
root,
root.firstElementChild,
);
}
});
}
window.InstantClick.on('change', () => {
loadComponent();
});
loadComponent();