import React, { useRef, useState } from "react" import { Link } from "react-router-dom"; import { useHistory } from "react-router-dom" import "./Login.css" export const Login = () => { const [email, set] = useState("") const existDialog = useRef() const history = useHistory() const existingUserCheck = () => { return fetch(`http://localhost:8088/users?email=${email}`) .then(res => res.json()) .then(user => user.length ? user[0] : false) } const handleLogin = (e) => { e.preventDefault() existingUserCheck() .then(exists => { if (exists) { localStorage.setItem("graphicsbaytracker_customer", exists.id) history.push("") } else { existDialog.current.showModal() } }) } return (
User does not exist

GraphicsBay Tracker

Please sign in

set(evt.target.value)} className="form-control" placeholder="Email address" required autoFocus />
Not a member yet?
Skip Login
) }