Die Gesellschaft der Gegenwart
diff --git a/client/src/components/state/CreatePublicState/CreatePublicState.js b/client/src/components/state/CreatePublicState/CreatePublicState.js
index d829970..5f82bd6 100644
--- a/client/src/components/state/CreatePublicState/CreatePublicState.js
+++ b/client/src/components/state/CreatePublicState/CreatePublicState.js
@@ -1,4 +1,8 @@
import React, { Component } from 'react';
+import PropTypes from 'prop-types';
+import { connect } from 'react-redux';
+import { Redirect } from 'react-router-dom';
+import { createPublicState } from '../../../actions/gameActions';
import { Form, Input, Button, Typography } from 'antd';
const layout = {
@@ -21,20 +25,33 @@ class CreatePublicState extends Component {
constructor(props) {
super(props);
this.state = {
- createErrorMessage: undefined
+ createErrorMessage: undefined,
+ stateCreated: undefined
};
};
onFinish = values => {
- // this.props.registerUser(values.username, values.password, (user) => {
- // this.setState({
- // registerErrorMessage: undefined
- // });
- // }, (error) => {
- // this.setState({
- // registerErrorMessage: error.message
- // });
- // });
+
+ let scb = (state) => {
+ console.log('state')
+ this.setState({
+ createErrorMessage: undefined,
+ stateCreated: state
+ });
+ };
+
+ let ecb = (error) => {
+ this.setState({
+ createErrorMessage: error.message
+ });
+ };
+
+ let requestData = {
+ name: values.name,
+ title: values.title
+ };
+
+ this.props.createPublicState(requestData, scb, ecb);
};
onFinishFailed = errorInfo => { };
@@ -46,63 +63,76 @@ class CreatePublicState extends Component {
errorMessageStyle = {};
}
- return (
-
+ )
+ }
}
};
-export default CreatePublicState;
+CreatePublicState.propTypes = {
+ createPublicState: PropTypes.func.isRequired
+};
+
+const mapStateToProps = state => ({});
+
+export default connect(mapStateToProps, { createPublicState })(CreatePublicState);
diff --git a/client/src/pages/PublicStateOverviewPage/PublicStateOverviewPage.js b/client/src/pages/PublicStateOverviewPage/PublicStateOverviewPage.js
new file mode 100644
index 0000000..1a4efc0
--- /dev/null
+++ b/client/src/pages/PublicStateOverviewPage/PublicStateOverviewPage.js
@@ -0,0 +1,29 @@
+import React, { Component } from 'react';
+import { withRouter } from 'react-router-dom';
+
+class PublicStateOverviewPage extends Component {
+
+ constructor(props) {
+ super(props);
+ this.state = {
+ name: undefined
+ };
+ }
+
+ componentDidMount() {
+ const name = this.props.match.params.name;
+ this.setState({
+ name: name
+ });
+ };
+
+ render() {
+ return (
+
+
Public State Overview: {this.state.name}
+
+ )
+ };
+};
+
+export default withRouter(PublicStateOverviewPage);
diff --git a/client/src/pages/SplashScreenPage/SplashScreenPage.js b/client/src/pages/SplashScreenPage/SplashScreenPage.js
index 99e0ce5..423b4f8 100644
--- a/client/src/pages/SplashScreenPage/SplashScreenPage.js
+++ b/client/src/pages/SplashScreenPage/SplashScreenPage.js
@@ -4,12 +4,10 @@ class SplashScreenPage extends Component {
render() {
return (
-
loading application...
-
)
};
diff --git a/client/src/pages/index.js b/client/src/pages/index.js
index 37c8442..b6f5a43 100644
--- a/client/src/pages/index.js
+++ b/client/src/pages/index.js
@@ -1,5 +1,6 @@
import DashboardPage from './DashboardPage/DashboardPage';
import LoginPage from './LoginPage/LoginPage';
+import PublicStateOverviewPage from './PublicStateOverviewPage/PublicStateOverviewPage';
import RegisterPage from './RegisterPage/RegisterPage';
import SplashScreenPage from './SplashScreenPage/SplashScreenPage';
import WelcomePage from './WelcomePage/WelcomePage';
@@ -7,6 +8,7 @@ import WelcomePage from './WelcomePage/WelcomePage';
export {
DashboardPage,
LoginPage,
+ PublicStateOverviewPage,
RegisterPage,
SplashScreenPage,
WelcomePage
diff --git a/client/src/reducers/stateData.js b/client/src/reducers/gameData.js
similarity index 100%
rename from client/src/reducers/stateData.js
rename to client/src/reducers/gameData.js
diff --git a/client/src/reducers/index.js b/client/src/reducers/index.js
index d9bdac4..068f0dd 100644
--- a/client/src/reducers/index.js
+++ b/client/src/reducers/index.js
@@ -1,7 +1,9 @@
import { combineReducers } from 'redux';
import appData from './appData';
+import gameData from './gameData'
export default combineReducers({
- appData
+ appData,
+ gameData
});
diff --git a/client/src/router/AppRouter.js b/client/src/router/AppRouter.js
index 38d5f6a..91d90bb 100644
--- a/client/src/router/AppRouter.js
+++ b/client/src/router/AppRouter.js
@@ -12,6 +12,7 @@ import { Layout } from 'antd';
import {
DashboardPage,
LoginPage,
+ PublicStateOverviewPage,
RegisterPage,
SplashScreenPage,
WelcomePage
@@ -22,21 +23,8 @@ import 'antd/dist/antd.css';
const { Content } = Layout;
// A wrapper for
that redirects to the login
-// screen if you're not yet authenticated.
+// screen if user is not yet authenticated.
export const PrivateRoute = ({ children, ...rest }) => {
-
- console.log('children: ' + children);
- const keys = Object.keys(children);
- console.log('children.keys: ' + keys);
- console.log('children.props: ' + keys.props);
- const childrenPropKeys = Object.keys(children.props);
- console.log('children.props.keys: ' + childrenPropKeys);
- console.log('rest: ' + rest);
- const restKeys = Object.keys(rest);
- console.log('rest.keys: ' + restKeys);
- console.log('rest.exact: ' + rest.exact);
- console.log('rest.user: ' + rest.user);
-
return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -110,7 +87,7 @@ class AppRouter extends Component {
)
} else {
return (
- loading application...
+
)
}
};