diff -r 3c9d3c8f41d1 -r 3b20e2b584fe client/src/components/Login.js --- a/client/src/components/Login.js Thu Jun 15 17:18:22 2017 +0200 +++ b/client/src/components/Login.js Fri Jun 16 18:36:39 2017 +0200 @@ -1,10 +1,10 @@ import React, { Component } from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; -import { Grid, Row, Col, Panel, FormGroup, ControlLabel, FormControl, Button } from 'react-bootstrap'; +import { Grid, Row, Col, Panel, FormGroup, ControlLabel, FormControl, Button, Alert } from 'react-bootstrap'; import '../App.css'; import Navbar from './Navbar'; -import * as sessionsActions from '../actions/sessionsActions'; +import * as authActions from '../actions/authActions'; class Login extends Component { @@ -12,8 +12,13 @@ const username = this.username.value; const password = this.password.value; - console.log(username, password); + this.props.authActions.loginSubmit(username, password); + } + renderError() { + return ( + Bad credentials + ) } render() { @@ -33,6 +38,7 @@ Password { this.password = ref; }} /> + { this.props.login.error && this.renderError() } @@ -46,14 +52,14 @@ function mapStateToProps(state, props) { return { - currentSession: state.get('currentSession'), - sessions: state.get('sessions') + currentUser: state.get('currentUser'), + login: state.get('login') }; } function mapDispatchToProps(dispatch) { return { - actions: bindActionCreators(sessionsActions, dispatch) + authActions: bindActionCreators(authActions, dispatch) } }