Newer
Older
import { Query } from 'react-apollo'
import { Loading, LoadingIcon } from '../ui'
import Review from './Review'
import { CURRENT_REVIEW } from './operations'
const ReviewWithHeader = SubmissionHeader(Review)
const ReviewPage = ({ match, ...props }) => (
<Query
fetchPolicy="cache-and-network"
query={GET_MANUSCRIPT}
variables={{ id: match.params.id }}
>
{({ data: { manuscript }, loading: loadingOne }) => (
<Query
query={CURRENT_REVIEW}
variables={{ manuscriptId: match.params.id }}
>
{({ data: { currentReview }, loading, refetch }) => {
if (loadingOne || !manuscript) {
return (
<Loading>
<LoadingIcon />
</Loading>
)
}
return (
<ReviewWithHeader
manuscript={manuscript}
match={match}
{...props}
/>
)
}}
</Query>
)}