Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update loginPage.js #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions src/components/loginPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -54,6 +56,6 @@ class LoginPage extends Component {
}
}

const mapStateToProps = (response) => ({response});
const mapStateToProps = response => ({ response });

export default connect(mapStateToProps)(LoginPage);
export default connect(mapStateToProps)(LoginPage);