-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Main Page constructed with fixes to components
- user Reducers implemented - Higher Order components introduced to protect routes - Tighter JSDocs introduced - Redirection of users on Login to Main Page - Validations for Sign In and Sign Up pages [finshes #152539728]
- Loading branch information
Benny Ogidan
authored and
Benny Ogidan
committed
Nov 7, 2017
1 parent
483e920
commit 2e69c07
Showing
33 changed files
with
710 additions
and
218 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import userReducer from '../../src/app/reducers/userReducers'; | ||
|
||
|
||
describe('User Reducer', () => { | ||
it(' has a default state', () => { | ||
expect(userReducer(undefined, { type: 'undefinedAction' })).toEqual({ | ||
|
||
}); | ||
}); | ||
}); |
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
Empty file.
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,30 @@ | ||
import React, {Component} from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import {login} from '../../../actions/authenticate'; | ||
import {connect} from 'react-redux'; | ||
import SignInForm from '../../presentation/authentication/SignInPage.jsx' | ||
|
||
class SignInPage extends React.Component { | ||
submit = (data)=> { | ||
this.props. | ||
login(data) | ||
.then(()=>{this.props.history.push('/mainpage')}) | ||
|
||
} | ||
render() { | ||
return ( | ||
<SignInForm submit={this.submit}/> | ||
|
||
); | ||
} | ||
|
||
} | ||
|
||
|
||
SignInPage.propTypes = { | ||
login: PropTypes.func.isRequired | ||
|
||
}; | ||
|
||
|
||
export default connect(null , { login }) (SignInPage); |
32 changes: 32 additions & 0 deletions
32
client/src/app/components/container/authentication/SignUpPage.jsx
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,32 @@ | ||
import React, {Component} from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import {signup} from '../../../actions/authenticate'; | ||
import {connect} from 'react-redux'; | ||
import SignUpform from '../../container/authentication/SignUpPage.jsx' | ||
|
||
|
||
class SignUpPage extends React.Component { | ||
submit = (data)=> { | ||
this.props. | ||
signup(data) | ||
.then(()=>{console.log('Nice to meet you')}) | ||
|
||
} | ||
render() { | ||
|
||
return ( | ||
<SignUpForm submit={this.submit}/> | ||
|
||
); | ||
} | ||
|
||
} | ||
|
||
|
||
SignUpPage.propTypes = { | ||
signup: PropTypes.func.isRequired | ||
|
||
}; | ||
|
||
|
||
export default connect(null , { signup }) (SignUpPage); |
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,11 @@ | ||
import {connect} from 'react-redux'; | ||
import Header from '../../presentation/common/header/Header.jsx'; | ||
|
||
|
||
const mapStateToProps = (state) => { | ||
return { | ||
isAuthenticated: state.userReducer.isAuthenticated | ||
}; | ||
} | ||
|
||
export default connect(mapStateToProps)(Header); |
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
Oops, something went wrong.