SystemContainer

master
Tudor Stanciu 2020-05-14 23:02:17 +03:00
parent 933ba890e5
commit 9840a61071
3 changed files with 43 additions and 42 deletions

View File

@ -1,35 +1,12 @@
import React from "react"; import React from "react";
import { Link } from "react-router-dom";
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { import SystemContainer from "../../features/system/components/SystemContainer";
loadSystemDateTime,
loadSystemVersion
} from "../../features/system/actionCreators";
const HomePage = ({ actions }) => {
const testButton = () => {
actions.loadSystemDateTime();
actions.loadSystemVersion();
};
const HomePage = () => {
return ( return (
<div className="jumbotron"> <>
<h1>Reverse proxy</h1> <SystemContainer />
<p>React, Redux and React Router for ultra-responsive web apps.</p> </>
<Link to="about" className="btn btn-primary btn-lg">
Learn more
</Link>
<button
style={{ marginBottom: 20 }}
className="btn btn-primary add-course"
onClick={testButton}
>
Test
</button>
</div>
); );
}; };
@ -37,17 +14,4 @@ HomePage.propTypes = {
actions: PropTypes.object.isRequired actions: PropTypes.object.isRequired
}; };
function mapStateToProps() { export default HomePage;
return {};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators(
{ loadSystemDateTime, loadSystemVersion },
dispatch
)
};
}
export default connect(mapStateToProps, mapDispatchToProps)(HomePage);

View File

@ -0,0 +1 @@
//TO DO

View File

@ -0,0 +1,36 @@
import React, { useEffect } from "react";
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import PropTypes from "prop-types";
import { loadSystemDateTime, loadSystemVersion } from "../actionCreators";
const SystemContainer = ({ actions }) => {
useEffect(() => {
actions.loadSystemDateTime();
actions.loadSystemVersion();
}, []);
return <div>TEST</div>;
};
SystemContainer.propTypes = {
actions: PropTypes.object.isRequired,
releaseNotes: PropTypes.array.isRequired
};
function mapStateToProps(state) {
return {
system: state.system
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators(
{ loadSystemDateTime, loadSystemVersion },
dispatch
)
};
}
export default connect(mapStateToProps, mapDispatchToProps)(SystemContainer);