I am using axios to fetch data from API endpoint. I am getting error -> Possible unhandled promise rejection Type error: undefined is not a function (evaluating res.json() )
I am using react-redux and redux-thunk with react native app.
venueAction.js :
import { FETCH_VENUES } from './types';
import axios from 'axios';
export const fetchVenues = () => dispatch => {
axios.get(`my_api_link`)
.then( res => res.json())
.then( venues =>
dispatch({
type: FETCH_VENUES,
payload: venues
})
)
.catch( error => {
console.log(error);
});
};
Check screenshot below: