f9cb5ac6b0
## Motivation As Graphcool is being shutdown, we replaced all the graphcool api endpoints with some handcrafted APIs using Prisma & Nexus, that can be found here https://github.com/prisma-labs/nextjs-graphql-api-examples. These GraphQL endpoints are now deployed to Vercel. ## Notes - I couldn't get the reason-relay example to run. Given that the relay endpoint works on the other relay example, I don't see any reason why it wouldn't work on that one - The `with-apollo` example is buggy when creating some posts, but nothing related to the switch of the api endpoint as it was already buggy before. I suspect the `concatPagination` strategy to be the cause of that bug, but I couldn't figure it out. Fixes #14780
28 lines
631 B
JavaScript
28 lines
631 B
JavaScript
import { createFragmentContainer, graphql } from 'react-relay'
|
|
import BlogPostPreview from './BlogPostPreview'
|
|
|
|
const BlogPosts = ({ viewer }) => (
|
|
<div>
|
|
<h1>Blog posts</h1>
|
|
<ul>
|
|
{viewer.allBlogPosts.edges.map(({ node }) => (
|
|
<BlogPostPreview key={node.id} post={node} />
|
|
))}
|
|
</ul>
|
|
</div>
|
|
)
|
|
|
|
export default createFragmentContainer(BlogPosts, {
|
|
viewer: graphql`
|
|
fragment BlogPosts_viewer on Viewer {
|
|
allBlogPosts(first: 10, orderBy: { createdAt: desc }) {
|
|
edges {
|
|
node {
|
|
...BlogPostPreview_post
|
|
id
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`,
|
|
})
|