const m = require('mithril') const Authentication = require('./authentication') const videos = require('./videos') const Browse = { oninit: function(vnode) { Authentication.requiresLogin() if (!videos.Tree.length) { this.refreshTree() } }, 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