nilan
07/19/2017, 7:34 PMErlang
snippet, @leandros šnilan
07/19/2017, 7:36 PMuser
07/19/2017, 7:36 PMnilan
07/19/2017, 7:38 PMcj5bdfoip1luc0111w9n5fpe4
bequis
07/19/2017, 7:38 PMconst FeedWithData = graphql(
gql`
query allMatches {
match {
homeTeam
score
awayTeam
}
}
`,
{
options: {
notifyOnNetworkStatusChange: true,
},
}
)(Matches);
But it gives me this error: Error: GraphQL error: Cannot query field 'match' on type 'Query'. (...)
bequis
07/19/2017, 7:39 PMbequis
07/19/2017, 7:42 PMconst FeedWithData = graphql(
gql`
query {
allMatches {
homeTeam
score
awayTeam
}
}
`,
{
options: {
notifyOnNetworkStatusChange: true,
},
}
)(Matches);
bequis
07/19/2017, 7:42 PMuser
07/19/2017, 8:00 PMnull
, when using the Relay API, you'll get back all Students, all will be null, except the one with the ID you specified in the permission query. You can use the Playground to compare the two results.bequis
07/19/2017, 8:03 PMconst FeedWithData = graphql(
gql`
query {
allMatches {
homeTeam
score
awayTeam
}
}
`,
{
options: {
notifyOnNetworkStatusChange: true,
},
}
)(Matches);
function MatchList({ data }) {
if (data.networkStatus === 1) {
return <ActivityIndicator style={styles.loading} />;
}
if (data.error) {
return <Text>Error: {data.error.message}</Text>
}
return (
<FlatList
data={data}
refreshing={data.networkStatus === 4}
onRefresh={() => data.refetch()}
renderItem={({ item }) => {
return (
<Text> {item.homeTeam} vs {item.awayTeam} </Text>
);
}}
/>
)
}
user
07/19/2017, 8:08 PMclaym
07/19/2017, 9:17 PMclaym
07/19/2017, 9:18 PMandyblack
07/19/2017, 9:21 PMexport default graphql(getUsers)(Home);
somehow? I found http://dev.apollodata.com/react/api-queries.html#graphql-query-data-error which helpfully says "If you do not handle this error you will get a warning in your console that says something like: "Unhandled (in react-apollo) Error: ..." without actually saying how to handle it...bequis
07/19/2017, 10:44 PMtype Match {
datePlayed: String!
}
How do I get all Matches of the same date?mikael
07/19/2017, 11:00 PM//
// We want to be able to filter users by age
// The argument is given a default value that allows all users to be returned
//
type Query {
allUsers(olderThan: Int = -1): [User!]!
}
//
// We can then filter our request by passing in a parameter in our query
//
{
allUsers(olderThan: 30) {
name
age
}
}
mikael
07/19/2017, 11:01 PMbrennen
07/19/2017, 11:07 PMconst connectMongo = require('./mongo-connector');
// 2
const start = async () => {
// 3
const mongo = await connectMongo();
var app = express();
app.use('/graphql', bodyParser.json(), graphqlExpress({
context: {mongo}, // 4
schema
}));
app.use('/graphiql', graphiqlExpress({
endpointURL: '/graphql',
}));
const PORT = 3000;
app.listen(PORT, () => {
console.log(`Hackernews GraphQL server running on port ${PORT}.`)
});
};
// 5
start();
in my index.js file. I do that and then I try and run the code and I get the following error: SyntaxError: Unexpected token (
Anyone have any idea what is going on?jasonmerino
07/19/2017, 11:09 PMjasonmerino
07/19/2017, 11:09 PMbrennen
07/19/2017, 11:10 PMconst start = async () => {
brennen
07/19/2017, 11:10 PMjasonmerino
07/19/2017, 11:12 PMbrennen
07/19/2017, 11:13 PM6.3.1
brennen
07/19/2017, 11:13 PMjasonmerino
07/19/2017, 11:15 PMjasonmerino
07/19/2017, 11:16 PMnilan
07/19/2017, 11:16 PMjasonmerino
07/19/2017, 11:17 PMnilan
07/19/2017, 11:17 PM