|
|
|
@@ -19,7 +19,6 @@ const fetchPosts = async tagName => (await axios.get (`${ API_BASE_URL }/posts`, |
|
|
|
{ params: { ...(tagName && { tags: tagName, |
|
|
|
match: 'all', |
|
|
|
limit: '20' }) } })).data.posts |
|
|
|
const fetchPostIds = async () => (await fetchPosts ()).map (post => post.id) |
|
|
|
|
|
|
|
const fetchTags = async () => (await axios.get (`${ API_BASE_URL }/tags`)).data |
|
|
|
const fetchTagNames = async () => (await fetchTags ()).map (tag => tag.name) |
|
|
|
@@ -33,7 +32,7 @@ const createPostListOutlet = async tagName => ` |
|
|
|
<div class="flex gap-4"><a href="#" class="font-bold">広場</a></div> |
|
|
|
<div class="mt-2"> |
|
|
|
<div class="flex flex-wrap gap-6 p-4"> |
|
|
|
${ (await fetchPosts (tagName)).map (post => ` |
|
|
|
${ (await fetchPosts (tagName)).slice (0, 20).map (post => ` |
|
|
|
<a class="w-40 h-40 overflow-hidden rounded-lg shadow-md hover:shadow-lg" |
|
|
|
href="/posts/${ post.id }"> |
|
|
|
<img alt="${ post.title }" |
|
|
|
@@ -42,7 +41,7 @@ const createPostListOutlet = async tagName => ` |
|
|
|
fetchpriority="high" |
|
|
|
decoding="async" |
|
|
|
class="object-none w-full h-full" |
|
|
|
src="${ post.url }" /> |
|
|
|
src="${ post.thumbnail }" /> |
|
|
|
</a>`).join ('') } |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|