Skip to content

Commit

Permalink
Get post thumbnail url from blog (#1184)
Browse files Browse the repository at this point in the history
  • Loading branch information
mateus4k authored Sep 16, 2021
1 parent bb55b2d commit 2f8e627
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/api/providers/BlogProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ const blogMethods = {
const response = await request.make({
query: `query getPosts($start: Int!, $limit: Int!) {
posts(sort: "published_at:desc", start: $start, limit: $limit) {
id, title, subtitle, published_at, slug
id,
title,
subtitle,
slug,
published_at,
thumbnail {
url
}
}
}`,
variables: { start: Number(params?.start) || 0, limit: Number(params?.limit) || 5 },
Expand All @@ -36,8 +43,9 @@ const blogMethods = {
id: post.id,
title: post.title,
subtitle: post.subtitle,
published_at: post.published_at,
url: `${Config.get('blog.clientUrl')}/${post.slug}`,
thumbnail: post.thumbnail?.url || null,
published_at: post.published_at,
}));
},
};
Expand Down

0 comments on commit 2f8e627

Please sign in to comment.