Rename variable, mutation

- result is not a good name in this case because we know what is coming back, the result is a socialMedia node
- update the mutation name in the front end
This commit is contained in:
Matt Rider 2019-04-08 12:05:57 -03:00
parent 832afee51d
commit 4de8407620
2 changed files with 4 additions and 4 deletions

View File

@ -3,19 +3,19 @@ import { neo4jgraphql } from 'neo4j-graphql-js'
export default {
Mutation: {
CreateSocialMedia: async (object, params, context, resolveInfo) => {
const result = await neo4jgraphql(object, params, context, resolveInfo, true)
const socialMedia = await neo4jgraphql(object, params, context, resolveInfo, true)
const session = context.driver.session()
await session.run(
`MATCH (owner:User {id: $userId}), (socialMedia:SocialMedia {id: $socialMediaId})
MERGE (socialMedia)<-[:OWNED]-(owner)
RETURN owner`, {
userId: context.user.id,
socialMediaId: result.id
socialMediaId: socialMedia.id
}
)
session.close()
return result
return socialMedia
}
}
}

View File

@ -77,7 +77,7 @@ export default {
.mutate({
mutation: gql`
mutation($url: String!) {
addSocialMedia(url: $url)
CreateSocialMedia(url: $url)
}
`,
variables: {