-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
499 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { Redirect } from 'react-router-dom'; | ||
import { socialMediaLogin } from './duck/operations'; | ||
import constants from './duck/constants'; | ||
import { RingLoaderComponent } from '../loaders'; | ||
/* eslint-disable react/prefer-stateless-function */ | ||
class SocialAuth extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = {}; | ||
} | ||
|
||
componentDidMount() { | ||
this.props.authLogin(window.location.search); | ||
} | ||
|
||
render() { | ||
const { loginState } = this.props; | ||
|
||
return ( | ||
<> | ||
<div className="centerDiv"> | ||
{loginState !== constants.LOGIN_SUCCESS && ( | ||
<div> | ||
<RingLoaderComponent /> | ||
<p>Logging in...</p> | ||
</div> | ||
)} | ||
</div> | ||
<div> | ||
{loginState === constants.LOGIN_SUCCESS && <Redirect to="/" />} | ||
</div> | ||
</> | ||
); | ||
} | ||
} | ||
|
||
const mapDispatchToProps = dispatch => { | ||
return { | ||
authLogin: params => { | ||
dispatch(socialMediaLogin(params)); | ||
}, | ||
}; | ||
}; | ||
|
||
const mapStateToProps = ({ login: { loginState, errorMessage } }) => { | ||
return { loginState, errorMessage }; | ||
}; | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps, | ||
)(SocialAuth); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`SOCIAL AUTH TEST SUITE SocialAuth Component should render the Social Auth Page 1`] = ` | ||
<ContextConsumer> | ||
<Component /> | ||
</ContextConsumer> | ||
`; | ||
|
||
exports[`SOCIAL AUTH TEST SUITE SocialAuth Component should render the Social Auth Page with facebook sign in 1`] = ` | ||
<Provider | ||
store={ | ||
Object { | ||
"clearActions": [Function], | ||
"dispatch": [Function], | ||
"getActions": [Function], | ||
"getState": [Function], | ||
"replaceReducer": [Function], | ||
"subscribe": [Function], | ||
} | ||
} | ||
> | ||
<Connect(SocialAuth) | ||
authLogin={[Function]} | ||
dispatch={[Function]} | ||
> | ||
<SocialAuth | ||
authLogin={[Function]} | ||
dispatch={[Function]} | ||
errorMessage="" | ||
loginState="" | ||
> | ||
<div | ||
className="centerDiv" | ||
> | ||
<div> | ||
<RingLoaderComponent> | ||
<div | ||
className="lds-ring" | ||
> | ||
<div /> | ||
<div /> | ||
<div /> | ||
<div /> | ||
<div /> | ||
</div> | ||
</RingLoaderComponent> | ||
<p> | ||
Logging in... | ||
</p> | ||
</div> | ||
</div> | ||
<div /> | ||
</SocialAuth> | ||
</Connect(SocialAuth)> | ||
</Provider> | ||
`; | ||
|
||
exports[`SOCIAL AUTH TEST SUITE SocialAuth Component should render the Social Auth Page with google sing in 1`] = ` | ||
<Provider | ||
store={ | ||
Object { | ||
"clearActions": [Function], | ||
"dispatch": [Function], | ||
"getActions": [Function], | ||
"getState": [Function], | ||
"replaceReducer": [Function], | ||
"subscribe": [Function], | ||
} | ||
} | ||
> | ||
<Connect(SocialAuth) | ||
authLogin={[Function]} | ||
dispatch={[Function]} | ||
> | ||
<SocialAuth | ||
authLogin={[Function]} | ||
dispatch={[Function]} | ||
errorMessage="" | ||
loginState="" | ||
> | ||
<div | ||
className="centerDiv" | ||
> | ||
<div> | ||
<RingLoaderComponent> | ||
<div | ||
className="lds-ring" | ||
> | ||
<div /> | ||
<div /> | ||
<div /> | ||
<div /> | ||
<div /> | ||
</div> | ||
</RingLoaderComponent> | ||
<p> | ||
Logging in... | ||
</p> | ||
</div> | ||
</div> | ||
<div /> | ||
</SocialAuth> | ||
</Connect(SocialAuth)> | ||
</Provider> | ||
`; | ||
|
||
exports[`SOCIAL AUTH TEST SUITE SocialAuth Component should throw exception when authentication fails 1`] = ` | ||
<Provider | ||
store={ | ||
Object { | ||
"clearActions": [Function], | ||
"dispatch": [Function], | ||
"getActions": [Function], | ||
"getState": [Function], | ||
"replaceReducer": [Function], | ||
"subscribe": [Function], | ||
} | ||
} | ||
> | ||
<Connect(SocialAuth) | ||
authLogin={[Function]} | ||
dispatch={[Function]} | ||
> | ||
<SocialAuth | ||
authLogin={[Function]} | ||
dispatch={[Function]} | ||
errorMessage="" | ||
loginState="" | ||
> | ||
<div | ||
className="centerDiv" | ||
> | ||
<div> | ||
<RingLoaderComponent> | ||
<div | ||
className="lds-ring" | ||
> | ||
<div /> | ||
<div /> | ||
<div /> | ||
<div /> | ||
<div /> | ||
</div> | ||
</RingLoaderComponent> | ||
<p> | ||
Logging in... | ||
</p> | ||
</div> | ||
</div> | ||
<div /> | ||
</SocialAuth> | ||
</Connect(SocialAuth)> | ||
</Provider> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export { default as loginReducer } from './reducers'; | ||
export { default as constants } from './constants'; | ||
export { default as doLogin } from './operations'; | ||
export { doLogin, updateLoginState } from './operations'; | ||
export { default as actions } from './actions'; | ||
export { default as types } from './types'; |
Oops, something went wrong.