JavaScript GraphQL - Syntax Error GraphQL request (5:15) Expected Name graphql syntax error expected name found,graphql syntax error expected

I am trying to implement a graphQL API, it went well with queries but it's going not that well with mutations:

Here is my basic mutation using apollo-client and graphql-tag:

import gql from 'graphql-tag'
const addNewPlace = (place) => {
    return client.mutate({
        mutation: gql`
        mutation {
          addNewPlace(
          input: {
            $title: String!
          }
          ) {
            place { title }
          }
        }
        `,
        variables: {
          title: place.title
        }
      })
  }

Here I was trying to use variables. When changing the mutation to look like that one below, it is going smoothly however, it's not the right way to do id.

const addNewPlace = (place) => {
    return client.mutate({
        mutation: gql`
        mutation {
          addNewPlace(
          input: {
            title: "${place.title}"
          }
          ) {
            place { title }
          }
        }
        `
    })
}

Any idea where I made my mistake?

Answer:1

I'm trying to find a way to take a link from one browser and open it in another browser. This could be taking a link from a Firefox tab and opening it in Chrome, or taking a link in a Chrome Incognito ...

I'm trying to find a way to take a link from one browser and open it in another browser. This could be taking a link from a Firefox tab and opening it in Chrome, or taking a link in a Chrome Incognito ...

I am trying to create a secure way for users to log in to and perform certain authorized actions on my custom website. I am trying to have good security without the use of SSL. At login now, this is ...

I am trying to create a secure way for users to log in to and perform certain authorized actions on my custom website. I am trying to have good security without the use of SSL. At login now, this is ...

I am trying to sort array of objects based on an integer property. When using lodash's method _.sortBy() the order is as expected but when I use the built in method it isn't right. Check the snippet ...

I am trying to sort array of objects based on an integer property. When using lodash's method _.sortBy() the order is as expected but when I use the built in method it isn't right. Check the snippet ...

  1. react native array prototype

Here is fiddle and this is my code: $(document).ready(function(){ $( ".keywordsdiv" ).each(function(){ $(this).children(".keywords").eq(3).after('<a href="" id="...

Here is fiddle and this is my code: $(document).ready(function(){ $( ".keywordsdiv" ).each(function(){ $(this).children(".keywords").eq(3).after('<a href="" id="...