pubsweet-component-wax
Version:
PubSweet component for the Wax collaborative document editor
62 lines (57 loc) • 1.06 kB
JavaScript
import React from 'react'
import { Query } from '@apollo/react-components'
import gql from 'graphql-tag'
const GET_BOOK_COMPONENT = gql`
query GetBookComponent($id: ID!) {
getBookComponent(id: $id) {
id
divisionId
divisionType
bookTitle
title
bookId
hasContent
componentTypeOrder
componentType
trackChangesEnabled
workflowStages {
label
type
value
}
lock {
userId
username
created
givenName
isAdmin
surname
}
nextBookComponent {
id
title
bookId
}
prevBookComponent {
id
title
bookId
}
content
}
}
`
const getBookComponentQuery = props => {
const { bookComponentId: id, render } = props
return (
<Query
fetchPolicy="cache-and-network"
query={GET_BOOK_COMPONENT}
variables={{ id }}
>
{render}
</Query>
)
}
export { GET_BOOK_COMPONENT }
export default getBookComponentQuery