scouttracker/src/containers/GetScoutData.js

39 lines
732 B
JavaScript
Raw Normal View History

2017-07-06 17:28:41 +00:00
import { gql, graphql } from 'react-apollo';
export default graphql(gql`
query GetScoutData($scoutID:ID!){
getScout(id: $scoutID){
2017-07-06 22:56:16 +00:00
displayName,
advancementDeadline,
2017-07-06 22:56:50 +00:00
adventures {
edges {
node {
name
}
}
},
achievements {
edges {
node {
2017-07-11 18:09:16 +00:00
number,
letter
2017-07-06 22:56:50 +00:00
}
}
}
2017-07-06 17:28:41 +00:00
}
}
2017-07-06 22:56:16 +00:00
`,{
options : ({scoutID}) => ({variables: {scoutID}}),
2017-07-06 22:56:50 +00:00
props: ({ ownProps, data }) => (
data.getScout ? {
scoutID: ownProps.scoutID,
displayName: data.getScout.displayName,
completedAdventures: data.getScout.adventures,
completedAchievements: data.getScout.achievements,
advancementDeadline: data.getScout.advancementDeadline
} : {
scoutID: ownProps.scoutID
}
)
2017-07-06 22:56:16 +00:00
});