From 812632ddd19ac8c23f2c8d6d3737e329ffe7aa8d Mon Sep 17 00:00:00 2001 From: Amir Farzan Najipour Date: Sun, 7 Apr 2019 10:32:34 +0430 Subject: [PATCH] Update loginPage.js --- src/components/loginPage.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/loginPage.js b/src/components/loginPage.js index 8179a6d..1b7a734 100644 --- a/src/components/loginPage.js +++ b/src/components/loginPage.js @@ -9,23 +9,25 @@ class LoginPage extends Component { onHandleLogin = (event) => { event.preventDefault(); - let email = event.target.email.value; - let password = event.target.password.value; + const email = event.target.email.value; + const password = event.target.password.value; const data = { - email, password + email, + password, }; this.props.dispatch(loginUserAction(data)); } render() { - let isSuccess, message; + let isSuccess; + let message; if (this.props.response.login.hasOwnProperty('response')) { isSuccess = this.props.response.login.response.success; message = this.props.response.login.response.message; - + if (isSuccess) { setCookie('token', this.props.response.login.response.token, 1); } @@ -54,6 +56,6 @@ class LoginPage extends Component { } } -const mapStateToProps = (response) => ({response}); +const mapStateToProps = response => ({ response }); -export default connect(mapStateToProps)(LoginPage); \ No newline at end of file +export default connect(mapStateToProps)(LoginPage);