Sei sulla pagina 1di 1

//actions folder

import { RESTAURANT_SHOW } from './types';


import axios from 'axios';

export const restaurantShow = () => {


return (dispatch) => {
dispatch({
type: RESTAURANT_SHOW,
payload: { data: response.data }
})
return axios.post('http://192.168.43.226/mine/react/restaurant.php')
// .then((response) => {
// Actions.main({ resdata: response.data });
//console.log(Actions.main({ resdata: response.data }));
// })
.then((response)=> {
(dispatch(getRestaurant(response.data))) //return
})
.catch((error) => {
console.log(error);
});
}
}

export function getRestaurant() {

return {
type: RESTAURANT_SHOW,
data
}
}

Potrebbero piacerti anche