import { Mutation, withApollo } from 'react-apollo' import gql from 'graphql-tag' import cookie from 'cookie' import redirect from '../lib/redirect' const CREATE_USER = gql` mutation Create($name: String!, $email: String!, $password: String!) { createUser(name: $name, authProvider: { email: { email: $email, password: $password }}) { id } signinUser(email: { email: $email, password: $password }) { token } } ` const RegisterBox = (props) => { let name, email, password return ( { // Store the token in cookie document.cookie = cookie.serialize('token', data.signinUser.token, { maxAge: 30 * 24 * 60 * 60 // 30 days }) // Force a reload of all the current queries now that the user is // logged in props.client.resetStore().then(() => { redirect({}, '/') }) }} onError={(error) => { // If you want to send error to external service? console.log(error) }}> {(create, { data, error }) => (
{ e.preventDefault() e.stopPropagation() create({ variables: { name: name.value, email: email.value, password: password.value }}) name.value = email.value = password.value = '' }}> { error &&

Issue occured while registering :(

} { name = node }} />
{ email = node }} />
{ password = node }} type='password' />
)}
) } export default withApollo(RegisterBox)