summaryrefslogtreecommitdiff
path: root/src/containers/auth
diff options
context:
space:
mode:
Diffstat (limited to 'src/containers/auth')
-rw-r--r--src/containers/auth/Login.js9
-rw-r--r--src/containers/auth/ProfileName.js16
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;