From 27f6237781bfe7fdc4ac1c7edaeee849434df92a Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Thu, 19 Apr 2018 16:51:22 -0400 Subject: Tests for singup --- frontend/components/Signup.js | 105 ++++++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 51 deletions(-) (limited to 'frontend/components') diff --git a/frontend/components/Signup.js b/frontend/components/Signup.js index d7c7062..a4bc13c 100644 --- a/frontend/components/Signup.js +++ b/frontend/components/Signup.js @@ -1,9 +1,8 @@ import React, { Component } from 'react'; -import { Mutation } from 'react-apollo'; +import { Mutation, ApolloConsumer } from 'react-apollo'; import { SIGNUP_MUTATION, CURRENT_USER_QUERY } from '../queries/queries'; import Form from './styles/Form'; import Error from './ErrorMessage'; -import { client } from '../lib/withData'; class Signup extends Component { state = { @@ -19,59 +18,63 @@ class Signup extends Component { render() { return ( - - {(signup, { loading, error }) => ( -
{ - e.preventDefault(); - const res = await signup(); - localStorage.setItem('token', res.data.signup.token); - client.query({ query: CURRENT_USER_QUERY, fetchPolicy: 'network-only' }); - }} - > -
- -

Sign Up for an Account

- + + {client => ( + + {(signup, { loading, error }) => ( + { + e.preventDefault(); + const res = await signup(); + localStorage.setItem('token', res.data.signup.token); + client.query({ query: CURRENT_USER_QUERY, fetchPolicy: 'network-only' }); + }} + > +
+ +

Sign Up for an Account

+ - + - + - -
- + +
+ + )} +
)} - + ); } } -- cgit v1.3