Jim
05/04/2018, 7:45 AMtype Location {
id: ID! @unique
name: String!
machineName: String
}
My query in graphiql works:
query {
locations(
where: {
machineName: "paris"
}
) {
id
name
machineName
}
}
Ive added a new resolver:
type Query {
location: Location
feed: [Post!]!
drafts: [Post!]!
post(id: ID!): Post
locations: [Location!]!
me: User
}
And created the resolver:
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
export const LOCATION_QUERY = gql`
query LocationQuery {
location(where: { machineName: "paris" }) {
id
name
machineName
}
}
`;
Moritz
05/04/2018, 8:18 AMJim
05/04/2018, 8:33 AMJim
05/04/2018, 8:33 AM(where: { machineName: "paris" })
Jim
05/04/2018, 9:23 AMnilan
05/04/2018, 9:39 AMJim
05/04/2018, 9:40 AMnilan
05/04/2018, 9:41 AMJim
05/04/2018, 9:41 AMJim
05/04/2018, 9:41 AMnilan
05/04/2018, 9:42 AM