|
@@ -1,36 +1,6 @@
|
|
import * as types from "../actionTypes/actionTypes";
|
|
import * as types from "../actionTypes/actionTypes";
|
|
const urlRegEvent = 'https://api-marathon.herokuapp.com/api/v1/eventUsers';
|
|
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 => ({
|
|
export const regEvent = payload => ({
|
|
type: types.POST_REGISTRATION_EVENT,
|
|
type: types.POST_REGISTRATION_EVENT,
|
|
payload
|
|
payload
|
|
@@ -66,43 +36,4 @@ export const regEventSubmit = payload => {
|
|
error => dispatch(regEventError(error))
|
|
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))
|
|
|
|
- )
|
|
|
|
- }
|
|
|
|
-}*/
|
|
|
|
|
|
+}
|