2 Commits 99161160ad ... daacc385ef

Autor SHA1 Mensagem Data
  Tanya Sashyna daacc385ef change 5 anos atrás
  Tanya Sashyna ca649fa31d some change 5 anos atrás

+ 6 - 4
src/actions/registrationEvent.js

@@ -1,23 +1,25 @@
 import * as types from "../actionTypes/actionTypes";
+const urlRegEvent = 'https://api-marathon.herokuapp.com/api/v1/eventUsers';
 
 export const regEvent = payload => ({
-    type: types.POST_REQUEST_CHECKIN,
+    type: types.POST_REGISTRATION_EVENT,
     payload
 });
 
 export const regEventSuccess = payload => ({
-    type: types.POST_REQUEST_SUCCESS_CHECKIN,
+    type: types.POST_REGISTRATION_EVENT_SUCCESS,
     payload
 });
 
 export const regEventError = payload => ({
-    type: types.POST_REQUEST_ERROR_CHECKIN,
+    type: types.POST_REGISTRATION_EVENT_ERROR,
     payload
 });
 
 export const regEventSubmit = payload => {
+    console.log('post');
     return dispatch => {
-        let promise = fetch("https://api-marathon.herokuapp.com/api/v1/eventUsers",
+        let promise = fetch(urlRegEvent,
             {
                 method: 'POST',
                 body: JSON.stringify(payload),

+ 1 - 1
src/components/adminResults/adminResultsForm.scss

@@ -2,7 +2,7 @@
 
 .results-form {
 	width: 100%;
-	min-height: 100vh;
+	flex-grow: 1;
 	margin: auto;
 
 	background: -webkit-linear-gradient(top, #fff, $color-blue);

+ 6 - 2
src/conteiners/eventCard/EventCard.js

@@ -80,7 +80,10 @@ export class EventCard extends React.Component {
                                     }
                                 </div>
                                 <div className="reg-form-event">
-                                    <RegFormEvent eventId={event._id} regEventSubmit={regEventSubmit}/>
+                                    <RegFormEvent 
+                                        eventId={event._id} 
+                                        regEventSubmit={regEventSubmit}
+                                    />
                                 </div>
                             </div>
                         </div>
@@ -94,7 +97,8 @@ export class EventCard extends React.Component {
 
 const mapStateToProps = state => {
     return {
-        event: state.getEventCard.event
+        event: state.getEventCard.event,
+        eventUsers: state.registrationEvent.eventUsers
     };
 };
 

+ 3 - 1
src/reducers/combineReducers.js

@@ -13,6 +13,7 @@ import allReviews from "./reviews";
 import adminResultsReduser from "./adminResultsReduser"
 import userInfo from "./getUserInfo"
 import results from "./getResults";
+import registrationEvent from "./registrationEvent";
 
 export default combineReducers({
 	form: formReducer,
@@ -27,5 +28,6 @@ export default combineReducers({
     logout,
     adminResultsReduser,
     userInfo,
-    results
+    results,
+    registrationEvent
 });

+ 1 - 0
src/reducers/getResults.js

@@ -14,6 +14,7 @@ export default (state = initialState, action) => {
 
         case types.GET_RESULT_SUCCESS: {            
             const resultsArr = action.payload.results;
+            //console.log(resultsArr);
             const marathoneResultsArr = resultsArr.filter( elem => elem.eventUser.distance === "Marathone" );
             
             const halfMarathoneResultsArr = resultsArr.filter( elem => elem.eventUser.distance === "Half marathone" );

+ 2 - 1
src/reducers/registrationEvent.js

@@ -1,7 +1,7 @@
 import * as types from "../actionTypes/actionTypes";
 
 const initialState = {
-    user: {}
+    eventUsers: []
 }
 
 export default (state = initialState, action) => {
@@ -15,6 +15,7 @@ export default (state = initialState, action) => {
         }
 
         case types.POST_REGISTRATION_EVENT_ERROR: {
+            console.log(action.payload.message);
             return state;
         }
 

+ 1 - 1
src/styles/custom.scss

@@ -15,7 +15,7 @@ html, body, #root {
 .container {
     display: flex;
     flex-direction: column;
-    height: 100%;
+    min-height: 100%;
 
     &-wrap {
         flex-grow: 1;