diff options
| author | Wes Bos <wesbos@gmail.com> | 2018-05-24 15:19:21 -0400 |
|---|---|---|
| committer | Wes Bos <wesbos@gmail.com> | 2018-05-24 15:19:21 -0400 |
| commit | 072eca0e5038a7755ca9b2c94dfe1a0c3f110968 (patch) | |
| tree | a6c54e1503baf665ad0eeaeaad6d2a2b7ba3ba39 /frontend/components/Signin.js | |
| parent | b294a6fa500b165aae86afbad5fce49a02314b0d (diff) | |
colocate queries and components
Diffstat (limited to 'frontend/components/Signin.js')
| -rw-r--r-- | frontend/components/Signin.js | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/frontend/components/Signin.js b/frontend/components/Signin.js index 23a5835..53cdb76 100644 --- a/frontend/components/Signin.js +++ b/frontend/components/Signin.js @@ -1,14 +1,26 @@ import React, { Component } from 'react'; -import { Mutation, ApolloConsumer } from 'react-apollo'; -import { SIGNIN_MUTATION, CURRENT_USER_QUERY } from '../queries/queries.graphql'; +import { Mutation } from 'react-apollo'; +import gql from 'graphql-tag'; +import { CURRENT_USER_QUERY } from './User'; import Error from './ErrorMessage'; import Form from './styles/Form'; +const SIGNIN_MUTATION = gql` + mutation SIGNIN_MUTATION($email: String!, $password: String!) { + signin(email: $email, password: $password) { + id + email + name + } + } +`; + class Signin extends Component { state = { - email: `wesbos@gmail.com`, - password: 'abc123', + email: '', + password: '', }; + saveToState = e => { const { name, value } = e.target; this.setState({ [name]: value }); @@ -64,3 +76,4 @@ class Signin extends Component { } export default Signin; +export { SIGNIN_MUTATION }; |
