diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-08-15 23:24:28 +0300 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-23 10:05:42 +0200 |
| commit | 91c8088e1d7def9242f60c708cd34f25dcb77d76 (patch) | |
| tree | b68065019692cea5cf6c3d14b811104aff2f0879 /src/containers/auth | |
| parent | d7512ace72448242b392299cf459c9c72c8dbee5 (diff) | |
Connect to backend and fetch initial project data
Diffstat (limited to 'src/containers/auth')
| -rw-r--r-- | src/containers/auth/Login.js | 9 | ||||
| -rw-r--r-- | src/containers/auth/ProfileName.js | 16 |
2 files changed, 22 insertions, 3 deletions
diff --git a/src/containers/auth/Login.js b/src/containers/auth/Login.js index 358ea7e9..f1deb33c 100644 --- a/src/containers/auth/Login.js +++ b/src/containers/auth/Login.js @@ -2,7 +2,7 @@ import PropTypes from "prop-types"; import React from "react"; import GoogleLogin from "react-google-login"; import {connect} from "react-redux"; -import {completeLogin} from "../../actions/auth"; +import {logIn} from "../../actions/auth"; class LoginContainer extends React.Component { static propTypes = { @@ -12,8 +12,11 @@ class LoginContainer extends React.Component { onAuthResponse(response) { this.props.onLogin({ + email: response.getBasicProfile().getEmail(), + givenName: response.getBasicProfile().getGivenName(), + familyName: response.getBasicProfile().getFamilyName(), googleId: response.googleId, - authToken: response.accessToken, + authToken: response.getAuthResponse().id_token, expiresAt: response.getAuthResponse().expires_at }); } @@ -44,7 +47,7 @@ const mapStateToProps = (state, ownProps) => { const mapDispatchToProps = dispatch => { return { - onLogin: (payload) => dispatch(completeLogin(payload)), + onLogin: (payload) => dispatch(logIn(payload)), }; }; diff --git a/src/containers/auth/ProfileName.js b/src/containers/auth/ProfileName.js new file mode 100644 index 00000000..27df133c --- /dev/null +++ b/src/containers/auth/ProfileName.js @@ -0,0 +1,16 @@ +import React from "react"; +import {connect} from "react-redux"; + +const mapStateToProps = state => { + return { + text: state.auth.givenName + " " + state.auth.familyName + }; +}; + +const SpanElement = ({text}) => <span>{text}</span>; + +const ProfileName = connect( + mapStateToProps +)(SpanElement); + +export default ProfileName; |
