Add a Posts Schema just to test authentication
This commit is contained in:
45
web/src/components/Post/PostsCell/PostsCell.tsx
Normal file
45
web/src/components/Post/PostsCell/PostsCell.tsx
Normal file
@ -0,0 +1,45 @@
|
||||
import type { FindPosts, FindPostsVariables } from 'types/graphql'
|
||||
|
||||
import { Link, routes } from '@redwoodjs/router'
|
||||
import type {
|
||||
CellSuccessProps,
|
||||
CellFailureProps,
|
||||
TypedDocumentNode,
|
||||
} from '@redwoodjs/web'
|
||||
|
||||
import Posts from 'src/components/Post/Posts'
|
||||
|
||||
export const QUERY: TypedDocumentNode<FindPosts, FindPostsVariables> = gql`
|
||||
query FindPosts {
|
||||
posts {
|
||||
id
|
||||
title
|
||||
body
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
export const Loading = () => <div>Loading...</div>
|
||||
|
||||
export const Empty = () => {
|
||||
return (
|
||||
<div className="rw-text-center">
|
||||
No posts yet.{' '}
|
||||
<Link to={routes.newPost()} className="rw-link">
|
||||
Create one?
|
||||
</Link>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export const Failure = ({ error }: CellFailureProps<FindPosts>) => (
|
||||
<div className="rw-cell-error">{error?.message}</div>
|
||||
)
|
||||
|
||||
export const Success = ({
|
||||
posts,
|
||||
}: CellSuccessProps<FindPosts, FindPostsVariables>) => {
|
||||
return <Posts posts={posts} />
|
||||
}
|
||||
Reference in New Issue
Block a user