const m = require('mithril') const Authentication = require('./authentication') const videos = require('./videos') const Browse = { oninit: function(vnode) { if (!videos.Tree.length) { this.refreshTree() } }, oncreate: function() { if (Authentication.currentUser) return }, refreshTree: function(vnode) { videos.refreshTree() }, view: function(vnode) { return [ videos.error ? m('div.full-error', { onclick: this.refreshTree.bind(this) }, [ videos.error, m('br'), 'Click here to try again' ]) : null, ] }, } module.exports = Browse