Tanya Sashyna 5 роки тому
батько
коміт
99161160ad

+ 5 - 3
src/components/eventInfoShort/EventInfoShort.js

@@ -14,9 +14,11 @@ export class EventInfoShort extends React.Component {
                             <h3 className="caption">{title}</h3>
                             <h3 className="caption">{title}</h3>
                             <div className="place">{country}, {city}</div>
                             <div className="place">{country}, {city}</div>
                         </div>
                         </div>
-                        <div className="event-date">
-                            { eventDate.map( (el,ind) =><span key={ind}>{el} </span>) }
-                        </div>
+                        {
+                            eventDate && <div className="event-date">
+                                { eventDate.map( (el,ind) =><span key={ind}>{el} </span>) }
+                            </div>
+                        }
                         <div className="bg-black"></div>
                         <div className="bg-black"></div>
                         <div className="event-picture">
                         <div className="event-picture">
                             <img src={imgSrc} alt={title} />
                             <img src={imgSrc} alt={title} />

+ 6 - 2
src/reducers/adminMainPageReducer.js

@@ -48,8 +48,12 @@ export default (state = initialState, action) => {
 			return state;
 			return state;
 		}
 		}
 		case types.GET_EVENTS_REQUEST_SUCCESS: {
 		case types.GET_EVENTS_REQUEST_SUCCESS: {
-			const { data } = action.payload;
-			const eventList = data.events
+			const { data } = action.payload;			
+			const eventList = data.events.map( event => ({
+					...event,
+					eventDate: new Date(event.eventDate).toDateString().split(' ').slice(1,4)
+				})
+			)
 			return { ...state, eventList };
 			return { ...state, eventList };
 		}
 		}
 		case types.GET_EVENTS_REQUEST_FAIL: {
 		case types.GET_EVENTS_REQUEST_FAIL: {