|
|
@@ -2,17 +2,18 @@ import { Actions } from 'react-native-router-flux';
|
|
|
import { post } from '../api/'
|
|
|
|
|
|
import {
|
|
|
- CURSADA_FETCH_SUCCESS,
|
|
|
CURSADAS_FETCH_SUCCESS,
|
|
|
+ CURSADA_FETCH_SUCCESS,
|
|
|
CURSADAS_FETCH_FAIL,
|
|
|
+ CURSADA_FETCH_FAIL,
|
|
|
CLASE_FETCH_SUCCESS,
|
|
|
+ CLASE_FETCH_FAIL,
|
|
|
CLASE_FETCH
|
|
|
} from './types';
|
|
|
|
|
|
export const cursadasFetch = () => {
|
|
|
return (dispatch) => {
|
|
|
- //const path = 'listaCursos.php';
|
|
|
- const path = 'qwrpoiewquewquoiewquoiewq.php';
|
|
|
+ const path = 'listaCursos.php';
|
|
|
post(path, { cursadas: 1 })
|
|
|
.then( (response) => {
|
|
|
dispatch({
|
|
|
@@ -21,55 +22,40 @@ export const cursadasFetch = () => {
|
|
|
});
|
|
|
})
|
|
|
.catch( (error) => {
|
|
|
- dispatch({
|
|
|
- type: CURSADAS_FETCH_FAIL
|
|
|
- })
|
|
|
+ dispatch({ type: CURSADAS_FETCH_FAIL })
|
|
|
});
|
|
|
};
|
|
|
};
|
|
|
|
|
|
export const cursadaFetch = ({_id}) => {
|
|
|
return (dispatch) => {
|
|
|
- fetch('https://plataforma.especificosba.com.ar/back/getCourse.php', {
|
|
|
- method: 'POST',
|
|
|
- headers: {
|
|
|
- 'Accept': 'application/json',
|
|
|
- 'Content-Type': 'application/json',
|
|
|
- },
|
|
|
- body: JSON.stringify({
|
|
|
- id: _id
|
|
|
- })
|
|
|
- })
|
|
|
- .then( (response) => response.json() )
|
|
|
- .then( (responseJson) => {
|
|
|
- dispatch({
|
|
|
- type: CURSADA_FETCH_SUCCESS,
|
|
|
- payload: responseJson
|
|
|
- });
|
|
|
- });
|
|
|
+ const path = 'getCourse.php';
|
|
|
+ post(path,{ id: _id })
|
|
|
+ .then( (response) => {
|
|
|
+ dispatch({
|
|
|
+ type: CURSADA_FETCH_SUCCESS,
|
|
|
+ payload: response
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch( (error) => {
|
|
|
+ dispatch({ type: CURSADA_FETCH_FAIL });
|
|
|
+ });
|
|
|
};
|
|
|
};
|
|
|
|
|
|
export const claseFetch = ({cursada, _id}) => {
|
|
|
return (dispatch) => {
|
|
|
dispatch({type: CLASE_FETCH});
|
|
|
- fetch('https://plataforma.especificosba.com.ar/back/getClase.php', {
|
|
|
- method: 'POST',
|
|
|
- headers: {
|
|
|
- 'Accept': 'application/json',
|
|
|
- 'Content-Type': 'application/json',
|
|
|
- },
|
|
|
- body: JSON.stringify({
|
|
|
- cursada,
|
|
|
- id: _id
|
|
|
- })
|
|
|
- })
|
|
|
- .then( (response) => response.json() )
|
|
|
- .then( (responseJson) => {
|
|
|
- dispatch({
|
|
|
- type: CLASE_FETCH_SUCCESS,
|
|
|
- payload: responseJson
|
|
|
- });
|
|
|
- });
|
|
|
+ const path = 'qqqgetClase.php';
|
|
|
+ post(path, { cursada, id: _id })
|
|
|
+ .then( (response) => {
|
|
|
+ dispatch({
|
|
|
+ type: CLASE_FETCH_SUCCESS,
|
|
|
+ payload: response
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch( (error) => {
|
|
|
+ dispatch({ type: CLASE_FETCH_FAIL });
|
|
|
+ });
|
|
|
};
|
|
|
};
|