Closed gHashTag closed 6 years ago
Why do I get this error and how do I fix it?
_onMasterCreate = async () => { const { name, profession, img, imgSmall, info } = this.state await this.props.mutate({ variables: { name, profession, img, imgSmall, info }, optimisticResponse: { __typename: 'Mutation', createTweet: { __typename: 'Tweet', name, profession, img, imgSmall, info, _id: Math.round(Math.random() * -1000000) } }, update: (store, { data: { createMaster } }) => { const data = store.readQuery({ query: GET_STUDIO_MASTERS }) console.log('date', data) if (!data.getStudioMasters.find(t => t._id === createMaster._id)) { store.writeQuery({ query: GET_STUDIO_MASTERS, data: { getStudioMasters: [{ ...createMaster }, ...data.getStudioMasters] } }) } } }) Keyboard.dismiss() this.props.navigation.goBack(null) }
export default gql` mutation createMaster($name: String!, $profession: String!, $img: String!, $imgSmall: String!, $info: String!) { createMaster( name: $name, profession: $profession, img: $img, imgSmall: $imgSmall, info: $info) { _id name profession img imgSmall info } } `
export default gql` { getStudioMasters { _id name profession img imgSmall info } } `
Sorry =) Fix type name createMaster
createMaster
Why do I get this error and how do I fix it?
mutate
createMaster
getStudioMasters