Updated graphql API to support v1.7.2 (#35896)

## Documentation / Examples
- [X] Make sure the linting passes by running `yarn lint`
Graphql API has updated with use of nodes, this bugfix updates these specifications.


Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
This commit is contained in:
Cozy Indigo 2022-05-29 08:49:59 +06:00 committed by GitHub
parent 69cc9b3633
commit c7ab218db2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 14 deletions

View file

@ -2,16 +2,16 @@ import Image from 'next/image'
export default function Avatar({ author }) {
const name = author
? author.firstName && author.lastName
? `${author.firstName} ${author.lastName}`
: author.name
? author.node.firstName && author.node.lastName
? `${author.node.firstName} ${author.node.lastName}`
: author.node.name
: null
return (
<div className="flex items-center">
<div className="w-12 h-12 relative mr-4">
<Image
src={author.avatar.url}
src={author.node.avatar.url}
layout="fill"
className="rounded-full"
alt={name}

View file

@ -8,7 +8,7 @@ export default function CoverImage({ title, coverImage, slug }) {
width={2000}
height={1000}
alt={`Cover Image for ${title}`}
src={coverImage?.sourceUrl}
src={coverImage?.node.sourceUrl}
className={cn('shadow-small', {
'hover:shadow-medium transition-shadow duration-200': slug,
})}

View file

@ -70,14 +70,18 @@ export async function getAllPostsForHome(preview) {
slug
date
featuredImage {
sourceUrl
node {
sourceUrl
}
}
author {
name
firstName
lastName
avatar {
url
node {
name
firstName
lastName
avatar {
url
}
}
}
}
@ -121,10 +125,14 @@ export async function getPostAndMorePosts(slug, preview, previewData) {
slug
date
featuredImage {
sourceUrl
node {
sourceUrl
}
}
author {
...AuthorFields
node {
...AuthorFields
}
}
categories {
edges {
@ -156,7 +164,9 @@ export async function getPostAndMorePosts(slug, preview, previewData) {
excerpt
content
author {
...AuthorFields
node {
...AuthorFields
}
}
}
}