I changed axios.ts file to make calls to my backend APIs
const axiosServices = axios.create({
baseURL: 'http://localhost:8088/swarm-api/'
});
and in my code I call a hook to fetch real data
useEffect(() => {
axios.get('dashboard/assetClassMenus')
.then(res => console.log(res))
.then((res) => setData([]));
}, [])
but in the chrome dev tools I see the "Wrong Services" error is thrown and in the network tab there is no trace of the call to the backend. Is something preventing the call to be made? Maybe some mock configuration must be switched off? If I use simple fetch calls it works.
Hello, Davide Cremonesi,
- Replace below code in axios.ts file at '../src/utils/' and for real call use Axios and for local use axios.
If still you have any other query, contact us.
Regards,
Amit Gorasiya