import React from 'react' import { Mutation } from 'react-apollo' import gql from 'graphql-tag' import { CURRENT_USER } from './User' const USER_LOGIN = gql` mutation USER_LOGIN($email: String!, $password: String!) { userLogin(email: $email, password: $password) { id email name abbreviation } } ` class UserLogin extends React.Component { state = { email: '', password: '' } handleInput = event => { this.setState({ [event.target.name]: event.target.value }) } render() { return ( {(userLogin, { error, loading }) => (
{ event.preventDefault() await userLogin() this.setState({ email: '', password: '' }) }} >

Log in

)}
) } } export default UserLogin