api handling in react js