aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/components/page
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/react/components/page')
-rw-r--r--src/client/react/components/page/Index.js10
-rw-r--r--src/client/react/components/page/User.js31
2 files changed, 33 insertions, 8 deletions
diff --git a/src/client/react/components/page/Index.js b/src/client/react/components/page/Index.js
index dcc521d..a91d7a9 100644
--- a/src/client/react/components/page/Index.js
+++ b/src/client/react/components/page/Index.js
@@ -1,16 +1,10 @@
import React from 'react';
-import PropTypes from 'prop-types';
import Search from '../container/Search';
-const App = ({ location }) => (
+const App = () => (
<div>
- <Search location={location} />
+ <Search />
</div>
);
-App.propTypes = {
- // eslint-disable-next-line react/forbid-prop-types
- location: PropTypes.object.isRequired,
-};
-
export default App;
diff --git a/src/client/react/components/page/User.js b/src/client/react/components/page/User.js
new file mode 100644
index 0000000..2ad65a6
--- /dev/null
+++ b/src/client/react/components/page/User.js
@@ -0,0 +1,31 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import { Redirect } from 'react-router-dom';
+import Search from '../container/Search';
+import users from '../../users';
+
+const App = ({ match }) => {
+ const user = `${match.params.type}/${match.params.value}`;
+
+ if (!users.allIds.includes(user)) {
+ // Invalid user, redirect to index.
+ return <Redirect to="/" />;
+ }
+
+ return (
+ <div>
+ <Search urlUser={user} />
+ </div>
+ );
+};
+
+App.propTypes = {
+ match: PropTypes.shape({
+ params: PropTypes.shape({
+ type: PropTypes.string.isRequired,
+ value: PropTypes.string.isRequired,
+ }).isRequired,
+ }).isRequired,
+};
+
+export default App;