text: import React, { useState } from "react";
  import { useMutation } from '@apollo/react-hooks';
  import { LOGIN } from "../utils/mutations"
  import Auth from "../utils/auth";
  import GoogleSignIn from '../components/GoogleSignIn';
  import Button from '@material-ui/core/Button';
  
  import Navbar from '../components/Navbar';
  
  function Login(props) {
    const [formState, setFormState] = useState({ email: '', password: '' })
    const [login, { error }] = useMutation(LOGIN);
  
    const handleFormSubmit = async event => {
      event.preventDefault();
      try {
        const mutationResponse = await login({ variables: { email: formState.email, password: formState.password } })
        const token = mutationResponse.data.login.token;
        Auth.login(token);
      } catch (e) {
        console.log(e)
      }
    };
  
    const handleChange = event => {
      const { name, value } = event.target;
      setFormState({
        ...formState,
        [name]: value
      });
    };
  
    return (
      <div className="container my-1">
        <Navbar/>
        <form className="form" onSubmit={handleFormSubmit}>
            <label>Email:</label>
            <input
              placeholder="youremail@test.com"
              name="email"
              type="email"
              id="email"
              onChange={handleChange}
            />
            <label>Password:</label>
            <input
              placeholder="******"
              name="password"
              type="password"
              id="pwd"
              onChange={handleChange}
            />
          {
            error ? <div>
              <p className="error-text" >The provided credentials are incorrect</p>
            </div> : null
          }
         <Button type="submit" variant="contained" color="default">
              LOGIN
            </Button>
  
            <br/>
             or <br/>
            <br/>
          <GoogleSignIn/>
          <br/>
          
        </form>
      </div>
    );
  }
  
  
  export default Login;
  