5 Commits ca649fa31d ... ee87d7ed2a

Autor SHA1 Nachricht Datum
  Tanya Sashyna ee87d7ed2a fix sidebar vor 5 Jahren
  Tanya Sashyna 239a2cca75 Merge branch 'dev' into Tanya vor 5 Jahren
  Tanya Sashyna 59bc0d043f merge with dev vor 5 Jahren
  Tanya Sashyna 16907048f9 change vor 5 Jahren
  Tanya Sashyna daacc385ef change vor 5 Jahren

+ 0 - 10
src/actionTypes/actionTypes.js

@@ -42,20 +42,10 @@ export const PUT_PHOTOGALARY_REQUEST = "PUT_PHOTOGALARY_REQUEST";
 export const PUT_PHOTOGALARY_REQUEST_SUCCESS = "PUT_PHOTOGALARY_REQUEST_SUCCESS";
 export const PUT_PHOTOGALARY_REQUEST_FAIL = "PUT_PHOTOGALARY_REQUEST_FAIL";
 
-//eventUser
-export const GET_REGISTRATION_EVENT = "GET_REGISTRATION_EVENT";
-export const GET_REGISTRATION_EVENT_SUCCESS = "GET_REGISTRATION_EVENT_SUCCESS";
-export const GET_REGISTRATION_EVENT_ERROR = "GET_REGISTRATION_EVENT_ERROR";
-
 export const POST_REGISTRATION_EVENT = "POST_REGISTRATION_EVENT";
 export const POST_REGISTRATION_EVENT_SUCCESS = "POST_REGISTRATION_EVENT_SUCCESS";
 export const POST_REGISTRATION_EVENT_ERROR = "POST_REGISTRATION_EVENT_ERROR";
 
-export const PUT_REGISTRATION_EVENT = "PUT_REGISTRATION_EVENT";
-export const PUT_REGISTRATION_EVENT_SUCCESS = "PUT_REGISTRATION_EVENT_SUCCESS";
-export const PUT_REGISTRATION_EVENT_ERROR = "PUT_REGISTRATION_EVENT_ERROR";
-//eventUser
-
 export const GET_LOGOUT_USER = "GET_LOGOUT_USER";
 export const GET_LOGOUT_USER_SUCCESS = "GET_LOGOUT_USER_SUCCESS";
 export const GET_LOGOUT_USER_ERROR = "GET_LOGOUT_USER_ERROR";

+ 1 - 71
src/actions/registrationEvent.js

@@ -1,36 +1,6 @@
 import * as types from "../actionTypes/actionTypes";
 const urlRegEvent = 'https://api-marathon.herokuapp.com/api/v1/eventUsers';
 
-//get
-export const getRegEvent = payload => ({
-    type: types.GET_REGISTRATION_EVENT,
-    payload
-});
-
-export const getRegEventSuccess = payload => ({
-    type: types.GET_REGISTRATION_EVENT_SUCCESS,
-    payload
-});
-
-export const getRegEventError = payload => ({
-    type: types.GET_REGISTRATION_EVENT_ERROR,
-    payload
-});
-
-export const getAllRegEvent = () => {
-    return dispatch => {
-        let promise = fetch(urlRegEvent)
-
-        dispatch(getRegEvent())
-
-        promise.then(
-            data => data.json().then(data => dispatch(getRegEventSuccess(data))),
-            error => dispatch(getRegEventError(error))
-        )
-    }
-}
-
-//post
 export const regEvent = payload => ({
     type: types.POST_REGISTRATION_EVENT,
     payload
@@ -47,7 +17,6 @@ export const regEventError = payload => ({
 });
 
 export const regEventSubmit = payload => {
-    console.log('post');
     return dispatch => {
         let promise = fetch(urlRegEvent,
             {
@@ -66,43 +35,4 @@ export const regEventSubmit = payload => {
             error => dispatch(regEventError(error))
         )
     }
-}
-
-//put
-/*export const putRegEvent = payload => ({
-    type: types.PUT_REGISTRATION_EVENT,
-    payload
-});
-
-export const putRegEventSuccess = payload => ({
-    type: types.PUT_REGISTRATION_EVENT_SUCCESS,
-    payload
-});
-
-export const putRegEventError = payload => ({
-    type: types.PUT_REGISTRATION_EVENT_ERROR,
-    payload
-});*/
-
-//передать обьект с id юзера и обьект event
-/*export const putRegEventSubmit = payload => {
-    console.log('action',payload.value);
-    return dispatch => {
-        let promise = fetch(`${urlRegEvent}/${payload.id}`,
-            {
-                method: 'PUT',
-                body: JSON.stringify(payload.value),
-                headers: {
-                    "Content-type": "application/json"
-                }
-            }
-        )
-
-        dispatch(putRegEvent())
-
-        promise.then(
-            data => data.json().then(data => dispatch(putRegEventSuccess(data))),
-            error => dispatch(putRegEventError(error))
-        )
-    }
-}*/
+}

+ 0 - 14
src/components/reg-form-event/RegFormEvent.js

@@ -6,26 +6,12 @@ import { customInput } from "../customFields/customInput/customInput";
 import { validationForms } from "../../utils/validationForms";
 
 let RegFormEvent = props => {
-    //const { handleSubmit, regEventSubmit, putRegEventSubmit, eventId, reset, eventUsers } = props;
     const { handleSubmit, regEventSubmit, eventId, reset } = props;
     const eventTypes = ['Select distance', 'Half marathone','Marathone'];
-    //console.log(eventUsers);
 
     const submit = value => {
         value.event = eventId;
         regEventSubmit(value);
-        /*console.log('value',value);
-        const emailUser = value.email;
-
-        const userEvent = eventUsers.find(el => el.email === emailUser );*/
-        //value.id = userEvent._id;
-        /*console.log('userEvent',userEvent);
-        !userEvent && regEventSubmit(value);
-
-        userEvent && putRegEventSubmit({
-            id: userEvent._id,
-            value: value
-        })*/
         reset();
     };
 

+ 2 - 2
src/components/sidebar/Sidebar.js

@@ -57,7 +57,7 @@ export class Sidebar extends React.Component {
                     </div>
                     <ul>
 						{
-                            role && <li><Link to="/profile">Profile</Link></li>
+                            role === 'user' && <li><Link to="/profile">Profile</Link></li>
 						}
 						
                         {
@@ -71,7 +71,7 @@ export class Sidebar extends React.Component {
                             !role && <li><Link to="/login">Login</Link></li>
 						}
                         {
-                            role && <li>
+                            role === 'user' && <li>
                                 <button className="logout" onClick={this.logoutHandler}>
                                     <i className="fa fa-sign-out"></i>
                                 </button>

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

@@ -2,7 +2,6 @@ import React from 'react';
 import { connect } from "react-redux";
 
 import { getRequestEvent } from "../../actions/getRequestEvent";
-//import { regEventSubmit, getAllRegEvent, putRegEventSubmit } from "../../actions/registrationEvent";
 import { regEventSubmit } from "../../actions/registrationEvent";
 
 import './eventCard.scss';
@@ -14,11 +13,9 @@ import RegFormEvent from '../../components/reg-form-event/RegFormEvent';
 export class EventCard extends React.Component {
     componentDidMount() {
         this.props.getRequestEvent(this.props.match.params.id);
-        //this.props.getAllRegEvent();
     }
 
     render() {
-        //const { event, regEventSubmit, getAllRegEvent, putRegEventSubmit, eventUsers } = this.props;
         const { event, regEventSubmit } = this.props;
         return (
             <>
@@ -86,9 +83,6 @@ export class EventCard extends React.Component {
                                     <RegFormEvent 
                                         eventId={event._id} 
                                         regEventSubmit={regEventSubmit}
-                                        /*getAllRegEvent={getAllRegEvent} 
-                                        putRegEventSubmit={putRegEventSubmit}
-                                        eventUsers={eventUsers}*/
                                     />
                                 </div>
                             </div>

+ 0 - 34
src/reducers/registrationEvent.js

@@ -6,25 +6,6 @@ const initialState = {
 
 export default (state = initialState, action) => {
     switch (action.type) {
-        //get
-        case types.GET_REGISTRATION_EVENT: {
-            return state;
-        }
-
-        case types.GET_REGISTRATION_EVENT_SUCCESS: {
-            //console.log('getRegEventUser', action.payload.eventusers)
-            return {
-                ...state,
-                eventUsers: action.payload.eventusers
-            };
-        }
-
-        case types.GET_REGISTRATION_EVENT_ERROR: {
-            console.log(action.payload.message);
-            return state;
-        }
-
-        //post
         case types.POST_REGISTRATION_EVENT: {
             return state;
         }
@@ -38,21 +19,6 @@ export default (state = initialState, action) => {
             return state;
         }
 
-        //put
-        case types.PUT_REGISTRATION_EVENT: {
-            return state;
-        }
-
-        case types.PUT_REGISTRATION_EVENT_SUCCESS: {
-            console.log('getRegEventUser',action.payload)
-            return state;
-        }
-
-        case types.PUT_REGISTRATION_EVENT_ERROR: {
-            console.log(action.payload);
-            return state;
-        }
-
         default:
             return state;
     }