From ef6aa810d42efa42820b8327a34702495f2ab217 Mon Sep 17 00:00:00 2001 From: kailasnadh790 <53608019+kailasnadh790@users.noreply.github.com> Date: Thu, 25 Jan 2024 16:23:44 -0500 Subject: [PATCH] Update article-list.js --- cigaradvisor/blocks/article-list/article-list.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cigaradvisor/blocks/article-list/article-list.js b/cigaradvisor/blocks/article-list/article-list.js index 9e4bf44c..7792ba15 100644 --- a/cigaradvisor/blocks/article-list/article-list.js +++ b/cigaradvisor/blocks/article-list/article-list.js @@ -66,8 +66,10 @@ async function renderByAuthor(wrapper, author) { async function renderByList(configs, wrapper, pinnedArticles) { // eslint-disable-next-line no-param-reassign pinnedArticles = Array.isArray(pinnedArticles) ? pinnedArticles : [pinnedArticles]; - const extra = []; - if (configs.next && !Number.isNaN(parseInt(configs.next, 10))) { + let extra = []; + if (configs.next && configs.next.toLowerCase() === 'all') { + extra = [...(await loadPosts())]; + } else if (configs.next && !Number.isNaN(parseInt(configs.next, 10))) { const total = parseInt(configs.next, 10); let i = 0; // Counter for how many we've found let idx = 1; // Counter for moving through the post list. @@ -125,7 +127,7 @@ export default async function decorate(block) { await renderByCategory(articleTeaserWrapper, category); } else if (author) { await renderByAuthor(articleTeaserWrapper, author); - } else if (articles) { + } else { await renderByList(configs, articleTeaserWrapper, articles); } @@ -134,7 +136,7 @@ export default async function decorate(block) { await renderByCategory(articleTeaserWrapper, category); } else if (author) { await renderByAuthor(articleTeaserWrapper, author); - } else if (articles) { + } else { await renderByList(configs, articleTeaserWrapper, articles); } });