Skip to content

Commit 5b46e47

Browse files
authored
refactor(bff): include id and type fields in wp requests (#65)
1 parent 71f3507 commit 5b46e47

File tree

2 files changed

+4
-4
lines changed
  • libs/blog-bff

2 files changed

+4
-4
lines changed

libs/blog-bff/articles/api/src/lib/api.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ app.get('/', wpClientMw, async (c) => {
3131
if (queryParams.authorSlug) {
3232
const authorResult = await c.var.wpClient.get<{ id }[]>('users', {
3333
slug: queryParams.authorSlug,
34-
_fields: 'id',
34+
_fields: 'id,type',
3535
});
3636
const id = authorResult.data[0]?.id;
3737
if (id) {
@@ -42,7 +42,7 @@ app.get('/', wpClientMw, async (c) => {
4242
const result = await c.var.wpClient.get<WPPostDto[]>('posts', {
4343
...query,
4444
_fields:
45-
'slug,title.rendered,author,excerpt.rendered,date,featured_image_url,author_details.name,author_details.avatar_url,author_details.slug,acf',
45+
'id,type,slug,title.rendered,author,excerpt.rendered,date,featured_image_url,author_details.name,author_details.avatar_url,author_details.slug,acf',
4646
});
4747

4848
return c.json(<ArrayResponse<ArticlePreview>>{
@@ -57,7 +57,7 @@ app.get('/:slug', wpClientMw, async (c) => {
5757
const result = await c.var.wpClient.get<WPPostDetailsDto[]>('posts', {
5858
slug: slug,
5959
_fields:
60-
'slug,title.rendered,author,content.rendered,date,featured_image_url,author_details,acf',
60+
'id,type,slug,title.rendered,author,content.rendered,date,featured_image_url,author_details,acf',
6161
});
6262

6363
return c.json(toArticle(result.data[0]));

libs/blog-bff/authors/api/src/lib/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ app.get('/:slug', wpClientMw, async (c) => {
1010

1111
const result = await c.var.wpClient.get<WPAuthorDto[]>('users', {
1212
slug: slug,
13-
_fields: 'slug,name,description,avatar_urls',
13+
_fields: 'id,type,slug,name,description,avatar_urls',
1414
});
1515

1616
return c.json(toAuthor(result.data[0]));

0 commit comments

Comments
 (0)