From 072eca0e5038a7755ca9b2c94dfe1a0c3f110968 Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Thu, 24 May 2018 15:19:21 -0400 Subject: colocate queries and components --- frontend/components/Signup.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'frontend/components/Signup.js') diff --git a/frontend/components/Signup.js b/frontend/components/Signup.js index 624bc10..9164e67 100644 --- a/frontend/components/Signup.js +++ b/frontend/components/Signup.js @@ -1,14 +1,25 @@ import React, { Component } from 'react'; import { Mutation } from 'react-apollo'; -import { SIGNUP_MUTATION, CURRENT_USER_QUERY } from '../queries/queries.graphql'; +import gql from 'graphql-tag'; +import { CURRENT_USER_QUERY } from './User'; import Form from './styles/Form'; import Error from './ErrorMessage'; +const SIGNUP_MUTATION = gql` + mutation SIGNUP_MUTATION($email: String!, $name: String!, $password: String!) { + signup(email: $email, name: $name, password: $password) { + id + email + name + } + } +`; + class Signup extends Component { state = { - email: `wesbos@gmail.com`, - name: 'Wes Bos', - password: 'wes', + email: '', + name: '', + password: '', }; saveToState = e => { @@ -79,3 +90,4 @@ class Signup extends Component { } export default Signup; +export { SIGNUP_MUTATION }; -- cgit v1.3