Added enter again on invoice modal.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { LockOutlined, UserOutlined } from "@ant-design/icons";
|
||||
import { Button, Form, Input } from "antd";
|
||||
import { LockFilled } from "@ant-design/icons";
|
||||
import React from "react";
|
||||
import { useApolloClient } from "react-apollo";
|
||||
import { connect } from "react-redux";
|
||||
@@ -10,17 +10,17 @@ import { UPSERT_USER } from "../../graphql/user.queries";
|
||||
import { emailSignInStart } from "../../redux/user/user.actions";
|
||||
import {
|
||||
selectCurrentUser,
|
||||
selectSignInError
|
||||
selectSignInError,
|
||||
} from "../../redux/user/user.selectors";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
signInError: selectSignInError
|
||||
signInError: selectSignInError,
|
||||
});
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
emailSignInStart: (email, password) =>
|
||||
dispatch(emailSignInStart({ email, password }))
|
||||
dispatch(emailSignInStart({ email, password })),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
@@ -29,12 +29,9 @@ export default connect(
|
||||
)(function SignInComponent({ emailSignInStart, currentUser, signInError }) {
|
||||
const apolloClient = useApolloClient();
|
||||
|
||||
const handleFinish = values => {
|
||||
console.log("Login");
|
||||
|
||||
const handleFinish = (values) => {
|
||||
const { email, password } = values;
|
||||
emailSignInStart(email, password);
|
||||
//Try to do the login using a saga here.
|
||||
};
|
||||
|
||||
if (currentUser.authorized === true) {
|
||||
@@ -43,17 +40,17 @@ export default connect(
|
||||
mutation: UPSERT_USER,
|
||||
variables: {
|
||||
authEmail: currentUser.email,
|
||||
authToken: currentUser.uid
|
||||
}
|
||||
authToken: currentUser.uid,
|
||||
},
|
||||
})
|
||||
.then()
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
console.log("User login upsert error.", error);
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div style={{ width: "450px" }}>
|
||||
{currentUser.authorized === true ? <Redirect to="/manage?" /> : null}
|
||||
|
||||
<img src={Logo} height="100" width="100" alt="Bodyshop.app" />
|
||||
@@ -61,33 +58,23 @@ export default connect(
|
||||
<Form onFinish={handleFinish}>
|
||||
<Form.Item
|
||||
name="email"
|
||||
label="E-mail"
|
||||
rules={[
|
||||
{
|
||||
//TODO Ensure using translations.
|
||||
type: "email",
|
||||
message: "Please enter a valid email."
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
message: "Please your email."
|
||||
}
|
||||
]}
|
||||
rules={[{ required: true, message: "Please input your email!" }]}
|
||||
>
|
||||
<Input />
|
||||
<Input
|
||||
prefix={<UserOutlined className="site-form-item-icon" />}
|
||||
placeholder="Username"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="password"
|
||||
rules={[{ required: true, message: "Please enter your password." }]}
|
||||
rules={[{ required: true, message: "Please input your Password!" }]}
|
||||
>
|
||||
<Input
|
||||
prefix={<LockFilled style={{ color: "rgba(0,0,0,.25)" }} />}
|
||||
prefix={<LockOutlined className="site-form-item-icon" />}
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<div>Forgot password</div>
|
||||
<Button type="primary" htmlType="submit">
|
||||
Log in
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user