Added connection lists to scout query

This commit is contained in:
John Shaver 2017-07-06 15:56:50 -07:00
parent c8d37bab15
commit aa8953ca1a
2 changed files with 30 additions and 13 deletions

View file

@ -1,13 +1,13 @@
import React from "react";
export default ScoutOverview = (
{scoutID,
export default ({
scoutID,
displayName,
advancementDeadline,
completedAdventures,
completedAchievements}
) => {
console.log(data);
completedAchievements
}) => {
console.log(displayName)
return (
<div>
{displayName}

View file

@ -6,16 +6,33 @@ export default graphql(gql`
getScout(id: $scoutID){
displayName,
advancementDeadline,
adventures,
acheivments,
adventures {
edges {
node {
name
}
}
},
achievements {
edges {
node {
name
}
}
}
}
}
`,{
options : ({scoutID}) => ({variables: {scoutID}}),
props: ({ ownProps, data }) => {
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
}
)
});