diff --git a/app/actions.js b/app/actions.js index ac3d5f1..b99e857 100644 --- a/app/actions.js +++ b/app/actions.js @@ -6,8 +6,8 @@ const init = (url = window.location.origin) => state => async actions => { if (state.isBeaker) { await medium.init(url) await medium.loadStyle() - const articles = await medium.preloadArticles() const { title, ...info } = await medium.loadInfo() + const articles = await medium.preloadArticles() actions.update({ articles, info, title }) } actions.update({ isLoading: false }) diff --git a/app/lib/medium.js b/app/lib/medium.js index 9f8c107..19a7f4f 100644 --- a/app/lib/medium.js +++ b/app/lib/medium.js @@ -23,21 +23,19 @@ class Medium { } async preloadArticles () { - debug('Pre-loading articles...') const files = await this.dat.readdir('/articles', { recursive: true, stat: true }) const articles = await Promise.all(files.filter(isMarkdown).map(file => this.loadArticle(file))) return articles.sort(byDate) } async loadInfo () { - debug('Loading info...') const info = await this.dat.getInfo() const blog = await this.dat.readFile('/blog.json') .then( config => JSON.parse(config), () => { console.error('/blog.json not found') } ) - blog.author = renderInline(blog.author) + blog.author = blog.author && renderInline(blog.author) info.description = renderInline(info.description) debug('Info loaded:', { ...info, ...blog }) return { ...info, ...blog }