nilan
01/28/2017, 4:19 AMnilan
01/28/2017, 4:19 AMnilan
01/28/2017, 4:20 AMmonkeybonkey
01/28/2017, 4:23 AMmonkeybonkey
01/28/2017, 4:23 AMmonkeybonkey
01/28/2017, 4:24 AMmonkeybonkey
01/28/2017, 4:24 AMmonkeybonkey
01/28/2017, 4:25 AMpuppycodes
01/28/2017, 4:28 AMpuppycodes
01/28/2017, 4:28 AMnilan
01/28/2017, 4:40 AMnilan
01/28/2017, 4:41 AMschickling
01/28/2017, 11:15 AMbrad.barnes
01/28/2017, 12:01 PMschickling
01/28/2017, 12:08 PMbrad.barnes
01/28/2017, 12:15 PMmartin
01/28/2017, 10:39 PMHome.js
import React from 'react'
import { graphql } from 'react-apollo'
import { userContactsQuery } from '../../graphql/queries'
import { modifyUserContacts } from '../../graphql/mutations'
class Home extends React.Component {
(โฆ)
}
export default graphql(modifyUserContacts)(
graphql(userContactsQuery, { options: { forceFetch: true } })(Home)
)
mutations.js
import gql from 'graphql-tag'
export const modifyUserContacts = gql`
mutation ($id: ID!, $firstName: String!, $lastName: String!, $birthDay: Int!, $birthMonth: Int!, $birthYear: Int!) {
updateUser(
id: $id,
firstName: $firstName,
lastName: $lastName,
birthDay: $birthDay,
birthMonth: $birthMonth,
birthYear: $birthYear) {
id
firstName
lastName
birthDay
birthMonth
birthYear
}
updateContacts(
id: $id
firstName: $firstName,
lastName: $lastName,
birthDay: $birthDay,
birthMonth: $birthMonth,
birthYear: $birthYear) {
id
firstName
lastName
birthDay
birthMonth
birthYear
}
}
`
The above code only produces this.props.user
and this.props.allContacts
as pulled from the queries.js
file (not listed here). There are no this.props.updateUser
or this.props.updateContacts
, though. In other words, queries
are working, but not the mutations
.martin
01/28/2017, 10:41 PMthis.props.updateQuery
though, with error message:
[Exception: TypeError: 'caller' and 'arguments' are restricted function properties and cannot be accessed in this context. at Function.remoteFunction (<anonymous>:3:14)]
tobias
01/29/2017, 8:31 AMschickling
01/29/2017, 11:25 AMtonietto
01/29/2017, 8:57 PMgroup
, that has a default value), declared in the query:
mutation createUser ($email: String!, $password: String!, $group: String) {
createUser(authProvider: {email: {email: $email, password: $password}}, group: $group) {
id
email
group
}
}
In Apollo app:
{
"email": "<mailto:email@email.com|email@email.com>",
"password": "123"
}
I've it fixed by not declaring it in the query:
mutation createUserWithoutGroup ($email: String!, $password: String!) {
createUser(authProvider: {email: {email: $email, password: $password}}) {
id
email
group
}
}
nilan
01/29/2017, 9:43 PMnull
for non-required, declared variables that you haven't defined in the variables
options (or when calling the mutation)nilan
01/29/2017, 9:43 PMnilan
01/29/2017, 9:44 PMmartin
01/29/2017, 10:36 PM{ name: 'updateUser' }
part.
export default graphql(modifyUserContacts, { name: 'updateUser' })(
graphql(modifyUserContacts, { name: 'createContact' })(
graphql(modifyUserContacts, { name: 'updateContact' })(
graphql(modifyUserContacts, { name: 'deleteContact' })(
graphql(userContactsQuery, { options: { forceFetch: true } })(Home)
)
)
)
)
georgelovegrove
01/29/2017, 10:56 PMnilan
01/29/2017, 11:23 PMgeorgelovegrove
01/29/2017, 11:26 PMambethia
01/30/2017, 6:48 AMnilan
01/30/2017, 7:18 AM