Ive added a content type to datamodel.graphql: ``...
# orm-help
j
Ive added a content type to datamodel.graphql:
Copy code
type Location {
	id: ID! @unique
	name: String!
	machineName: String
}
My query in graphiql works:
Copy code
query {
  locations(
    where: {
      machineName: "paris"
    }
  ) {
    id
    name
    machineName
  }
}
Ive added a new resolver:
Copy code
type Query {
  location: Location
  feed: [Post!]!
  drafts: [Post!]!
  post(id: ID!): Post
  locations: [Location!]!
  me: User
}
And created the resolver:
Copy code
location(parent, { machineName }, ctx, info) {
    return ctx.db.query.location({ where: { machineName } }, info);
  },
But I try to call it from React I get an error:
Network error: Response not successful: Received status code 400
Copy code
export const LOCATION_QUERY = gql`
  query LocationQuery {
    location(where: { machineName: "paris" }) {
      id
      name
      machineName
    }
  }
`;
m
What do your server logs say? Does your request even reach your server?
j
Ah it fails as soon as I add this
Copy code
(where: { machineName: "paris" })
Ive managed to get it working, thanks for taking an interest
n
how? ๐Ÿ™‚
j
Trial and error mostly ๐Ÿ˜‰
n
Ok ๐Ÿ˜„ usually a pretty good strategy!
j
๐Ÿ’ฏ 1
@nilan Let me know if thereโ€™s any more info that I can provide that would help others
n
sure, will do so later ๐Ÿ™Œ