hidjou / classsed-graphql-mern-apollo

408 stars 255 forks source link

Getting error on register form "Cannot read property 'username' of undefined. #35

Closed ghost closed 3 years ago

ghost commented 3 years ago

45 | name="username" 46 | type="text" 47 | value={values.username}

48 | error={errors.username ? true : false} 49 | onChange={onChange} 50 | /> 51 | <Form.Input

so I know 'errors' is undefined.

const [addUser, {loading}] = useMutation(REGISTER_USER, { update(_, result){ console.log(result) props.history.push('/') }, onError(err){ console.log(err.graphQLErrors[0].extensions.exception.errors) setErrors(err.graphQLErrors[0].extensions.exception.errors) }, variables: values }) this is where we set the error property, right? Is it not setting it correctly? is there an updated way for graphql to set errors?

ghost commented 3 years ago

figured it out. Maybe its an update but it should not include "exception"

meganlynn21 commented 2 years ago

THANK YOU been trying to figure this out lol