|
@@ -1,4 +1,4 @@
|
|
|
-import React, { useEffect } from "react";
|
|
|
+import React, {useState, useEffect } from "react";
|
|
|
import { Switch, Route, withRouter } from "react-router-dom";
|
|
|
import { connect } from "react-redux";
|
|
|
|
|
@@ -7,6 +7,7 @@ import { getAllEvents } from "./actions/getAllEvents";
|
|
|
import AdminMainPage from './conteiners/adminMainPage/adminMainPage';
|
|
|
import AdminAddEventPage from './conteiners/adminAddEventPage/adminAddEventPage';
|
|
|
import AdminMyEventsPage from './conteiners/adminMyEventsPage/adminMyEventsPage';
|
|
|
+import AdminAddPhotogalarytPage from "./conteiners/adminPhotogalaryPage/adminPhotogalaryPage"
|
|
|
|
|
|
import Home from './conteiners/home/Home';
|
|
|
import Result from './conteiners/result/Result';
|
|
@@ -18,7 +19,6 @@ import Events from './conteiners/events/Events';
|
|
|
import EventCard from './conteiners/eventCard/EventCard';
|
|
|
|
|
|
import Profile from './conteiners/profile/Profile';
|
|
|
-import AdminAddPhotogalarytPage from "./conteiners/adminPhotogalaryPage/adminPhotogalaryPage"
|
|
|
|
|
|
import { PrivateRoute } from "./private-router";
|
|
|
|
|
@@ -30,7 +30,8 @@ const route = [
|
|
|
exact: true,
|
|
|
path: "/",
|
|
|
protected: false,
|
|
|
- component: Home,
|
|
|
+ component: Home,
|
|
|
+ events: true
|
|
|
},
|
|
|
{
|
|
|
id: 2,
|
|
@@ -121,6 +122,17 @@ const route = [
|
|
|
];
|
|
|
|
|
|
// export const Router = withRouter(({ history }) => {
|
|
|
+
|
|
|
+// const [events, setEvents] = useState([]);
|
|
|
+
|
|
|
+// useEffect(() => {
|
|
|
+// fetch("https://api-marathon.herokuapp.com/api/v1/event")
|
|
|
+// .then(response => response.json())
|
|
|
+// .then(json => setEvents(json));
|
|
|
+// }, []);
|
|
|
+
|
|
|
+// console.log('events', events)
|
|
|
+
|
|
|
// useEffect(() => {
|
|
|
// const user = localStorage.getItem("user");
|
|
|
// if (user) {
|
|
@@ -136,6 +148,7 @@ const route = [
|
|
|
|
|
|
// return (
|
|
|
// <div className="container">
|
|
|
+// {console.log('events', events)}
|
|
|
// <Switch>
|
|
|
// {route.map(el => (
|
|
|
// <PrivateRoute
|
|
@@ -144,9 +157,19 @@ const route = [
|
|
|
// exact={el.exact}
|
|
|
// path={el.path}
|
|
|
// component={el.component}
|
|
|
-// events={el.events}
|
|
|
+// events = {el.events && events}
|
|
|
// />
|
|
|
// ))}
|
|
|
+
|
|
|
+// {
|
|
|
+// events.map(event =>
|
|
|
+// <Route exact
|
|
|
+// path={`/events/${event._id}`}
|
|
|
+// key={event._id}
|
|
|
+// render={ props => (<EventCard event={event} />) }
|
|
|
+// />
|
|
|
+// )
|
|
|
+// }
|
|
|
// </Switch>
|
|
|
// </div>
|
|
|
// );
|