Refactoring graphQL with fragments

This commit is contained in:
Nikola Bjelo committed 2018-10-30 07:54:20 +01:00
1 parent 3189e5b27f
commit 70d1f20ece
8 files changed
+112 -41

No files matched your search

+2 -18
View File
@@ -1,5 +1,4 @@
import React from 'react'
import gql from 'graphql-tag'
import { Query } from 'react-apollo'
import Typography from '@material-ui/core/Typography'
@@ -7,22 +6,7 @@ import { withStyles } from '@material-ui/core/styles'
import styles from './styles'
const HOSTS_EVENT = gql`
query Hosts_Event($designator: ID!){
hosts_Event(designator: $designator) {
name
designator
startDatetime
finishDatetime
host {
alias
firstName
lastName
}
description
}
}
`
import { showEventCalls } from '../../GraphQL/Calls/index'
class Edit extends React.Component {
render () {
@@ -37,7 +21,7 @@ class Edit extends React.Component {
Enroll in an competition {this.props.match.params.slug}
</Typography>
<Query
query={HOSTS_EVENT}
query={showEventCalls.HOSTS_EVENT}
variables={{ designator: this.props.match.params.slug }}
>
{({ loading, error, data }) => {