Skip to content

Commit

Permalink
update: toybox-blogの記事も一覧に表示するよう更新
Browse files Browse the repository at this point in the history
  • Loading branch information
PigeonsHouse committed Nov 28, 2023
1 parent 3e94733 commit a64b338
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions pages/blog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
</template>

<script>
import axios from 'axios'
import CardList from '~/components/card/CardList.vue'
import BaseBreadcrumbs from '~/components/commons/BaseBreadcrumbs.vue'
Expand All @@ -34,9 +36,57 @@ export default {
content_type: 'blog',
order: '-sys.createdAt',
}),
]).then(([blog]) => {
await axios.get(`${process.env.TOYBOX_API_BASE_URL}/blogs`),
]).then(([ctfResult, toyboxResult]) => {
const blogs = toyboxResult.data.blogs.map((blog) => {
const tags = blog.tags.map((tag) => {
return {
fields: {
name: tag.name,
},
sys: {
id: tag.id,
},
}
})
return {
fields: {
body: blog.body_text,
digest: blog.body_text,
tags,
thumbnail: {
fields: {
file: {
url: blog.thumbnail.url,
},
},
},
title: blog.title,
user: [
{
fields: {
name: blog.user.name,
icon: {
fields: {
file: {
url: blog.user.avatar_url,
},
},
},
},
sys: {
id: blog.user.id,
},
},
],
},
sys: {
id: blog.id,
},
}
})
return {
entry_list: blog.items,
entry_list: blogs.concat(ctfResult.items),
}
})
} catch (e) {
Expand Down

0 comments on commit a64b338

Please sign in to comment.