import React, { useState } from "react"; import { Form, Input, Button, Alert } from "antd"; import UserService from "../service/UserService"; import { useHistory } from "react-router-dom"; export default function LoginPage() { const [error, setError] = useState(); const history = useHistory(); const onSubmit = ({ email, password }) => { UserService.login(email, password) .then(() => history.push("/profile")) .catch((err) => { setError(err); }); }; const layout = { labelCol: { span: 8 }, wrapperCol: { span: 4 }, }; const tailLayout = { wrapperCol: { offset: 8, span: 4 }, }; return ( <> {error && }
); }