text: import { useMutation } from '@redwoodjs/web'
  import { toast } from '@redwoodjs/web/toast'
  import { navigate, routes } from '@redwoodjs/router'
  import PostForm from 'src/components/PostForm'
  
  const CREATE_POST_MUTATION = gql`
    mutation CreatePostMutation($input: CreatePostInput!) {
      createPost(input: $input) {
        id
      }
    }
  `
  
  const NewPost = () => {
    const [createPost, { loading, error }] = useMutation(CREATE_POST_MUTATION, {
      onCompleted: () => {
        toast.success('Post created')
        navigate(routes.posts())
      },
    })
  
    const onSave = (input) => {
      createPost({ variables: { input } })
    }
  
    return (
      <div className="rw-segment">
        <header className="rw-segment-header">
          <h2 className="rw-heading rw-heading-secondary">New Post testing</h2>
        </header>
        <div className="rw-segment-main">
          <PostForm onSave={onSave} loading={loading} error={error} />
        </div>
      </div>
    )
  }
  
  export default NewPost
  