diff --git a/lib/routes/aeon/category.ts b/lib/routes/aeon/category.ts index 714bd4ec5..0ad052531 100644 --- a/lib/routes/aeon/category.ts +++ b/lib/routes/aeon/category.ts @@ -39,43 +39,43 @@ export const route: Route = { const ENDPOINT = 'https://api.aeonmedia.co/graphql'; const LIST_BY_SECTION = /* GraphQL */ ` -query getAeonArticlesBySection($section: String!, $sortField: ArticleSortEnum = published_at, $afterCursor: String, $tag: String) { - section(site: aeon, slug: $section) { - slug - title - metaDescription - } - articles( - site: aeon - section: $section - status: [published] - tag: $tag - sort: {field: $sortField, order: desc} - after: $afterCursor - first: 24 - ) { - nodes { - slug - ...aeonArticleCardFragment + query getAeonArticlesBySection($section: String!, $sortField: ArticleSortEnum = published_at, $afterCursor: String, $tag: String) { + section(site: aeon, slug: $section) { + slug + title + metaDescription + } + articles(site: aeon, section: $section, status: [published], tag: $tag, sort: { field: $sortField, order: desc }, after: $afterCursor, first: 24) { + nodes { + slug + ...aeonArticleCardFragment + } + pageInfo { + hasNextPage + endCursor + } + } } - pageInfo { - hasNextPage - endCursor - } - } -} -fragment aeonArticleCardFragment on Article { - id - title - slug - type - standfirstLong - authors { name } - image { url } - primaryTopic { title } - section { slug } -} + fragment aeonArticleCardFragment on Article { + id + title + slug + type + standfirstLong + authors { + name + } + image { + url + } + primaryTopic { + title + } + section { + slug + } + } `; async function handler(ctx) { diff --git a/lib/routes/aeon/type.ts b/lib/routes/aeon/type.ts index 8ff0afdba..a105aacbe 100644 --- a/lib/routes/aeon/type.ts +++ b/lib/routes/aeon/type.ts @@ -5,34 +5,34 @@ import { getData } from './utils'; const ENDPOINT = 'https://api.aeonmedia.co/graphql'; const LIST_BY_TYPE = /* GraphQL */ ` -query getAeonArticlesByType($type: [ArticleTypeEnum!], $sortField: ArticleSortEnum = published_at, $afterCursor: String, $tag: String) { - articles( - site: aeon - type: $type - status: [published] - tag: $tag - sort: {field: $sortField, order: desc} - after: $afterCursor - first: 12 - ) { - nodes { - slug - ...aeonArticleCardFragment + query getAeonArticlesByType($type: [ArticleTypeEnum!], $sortField: ArticleSortEnum = published_at, $afterCursor: String, $tag: String) { + articles(site: aeon, type: $type, status: [published], tag: $tag, sort: { field: $sortField, order: desc }, after: $afterCursor, first: 12) { + nodes { + slug + ...aeonArticleCardFragment + } + } } - } -} -fragment aeonArticleCardFragment on Article { - id - title - slug - type - standfirstLong - authors { name } - image { url } - primaryTopic { title } - section { slug } -} + fragment aeonArticleCardFragment on Article { + id + title + slug + type + standfirstLong + authors { + name + } + image { + url + } + primaryTopic { + title + } + section { + slug + } + } `; export const route: Route = { diff --git a/lib/routes/aeon/utils.tsx b/lib/routes/aeon/utils.tsx index 4d9e71725..4ce6257dc 100644 --- a/lib/routes/aeon/utils.tsx +++ b/lib/routes/aeon/utils.tsx @@ -9,29 +9,41 @@ import { parseDate } from '@/utils/parse-date'; const ENDPOINT = 'https://api.aeonmedia.co/graphql'; const ESSAY = /* GraphQL */ ` -query getAeonEssay($slug: String!) { - essay(slug: $slug) { - publishedAt - updatedAt - authors { name authorBio } - audioUrl - image { url alt caption } - body + query getAeonEssay($slug: String!) { + essay(slug: $slug) { + publishedAt + updatedAt + authors { + name + authorBio + } + audioUrl + image { + url + alt + caption + } + body + } } -}`; +`; const VIDEO = /* GraphQL */ ` -query getAeonVideo($slug: String!, $site: SiteEnum!) { - video(slug: $slug, site: $site) { - publishedAt - updatedAt - authors { name authorBio } - hoster - hosterId - credits - description + query getAeonVideo($slug: String!, $site: SiteEnum!) { + video(slug: $slug, site: $site) { + publishedAt + updatedAt + authors { + name + authorBio + } + hoster + hosterId + credits + description + } } -}`; +`; const renderVideoDescription = (article) => { let video = article.hosterId;