routing improvement
This commit is contained in:
parent
42981a4f11
commit
a99ecc36a4
@ -9,6 +9,7 @@ class IsLoggedRoute extends Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
!this.props.progress ?
|
||||
<Route
|
||||
{...this.props.exact}
|
||||
render={({ location }) =>
|
||||
@ -23,17 +24,19 @@ class IsLoggedRoute extends Component {
|
||||
/>
|
||||
)
|
||||
}
|
||||
/>
|
||||
/> : null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
IsLoggedRoute.propTypes = {
|
||||
isAuthenticated: PropTypes.bool.isRequired
|
||||
isAuthenticated: PropTypes.bool.isRequired,
|
||||
progress: PropTypes.bool.isRequired
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
isAuthenticated: state.auth.isAuthenticated,
|
||||
progress: state.auth.progress
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, null)(IsLoggedRoute);
|
||||
|
@ -9,6 +9,7 @@ class PrivateRoute extends Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
!this.props.progress ?
|
||||
<Route
|
||||
{...this.props.exact}
|
||||
render={({ location }) =>
|
||||
@ -25,17 +26,19 @@ class PrivateRoute extends Component {
|
||||
)
|
||||
})()
|
||||
}
|
||||
/>
|
||||
/> : null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
PrivateRoute.propTypes = {
|
||||
isAuthenticated: PropTypes.bool.isRequired
|
||||
isAuthenticated: PropTypes.bool.isRequired,
|
||||
progress: PropTypes.bool.isRequired
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
isAuthenticated: state.auth.isAuthenticated
|
||||
isAuthenticated: state.auth.isAuthenticated,
|
||||
progress: state.auth.progress
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, null)(withRouter(PrivateRoute));
|
||||
|
@ -9,6 +9,7 @@ class PrivateRoute extends Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
!this.props.progress ?
|
||||
<Route
|
||||
{...this.props.exact}
|
||||
render={({ location }) =>
|
||||
@ -27,19 +28,21 @@ class PrivateRoute extends Component {
|
||||
)
|
||||
})()
|
||||
}
|
||||
/>
|
||||
/> : null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
PrivateRoute.propTypes = {
|
||||
isAuthenticated: PropTypes.bool.isRequired,
|
||||
user: PropTypes.object
|
||||
user: PropTypes.object,
|
||||
progress: PropTypes.bool.isRequired
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
isAuthenticated: state.auth.isAuthenticated,
|
||||
user: state.auth.user
|
||||
user: state.auth.user,
|
||||
progress: state.auth.progress
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, null)(withRouter(PrivateRoute));
|
||||
|
Loading…
x
Reference in New Issue
Block a user