I’m using axios for all my api calls on my Ionic App with Vue. When I build my app on Xcode I got the error “Network error”.
{"message":"Network Error","name":"Error","stack":"capacitor://localhost/js/chunk-vendors.48c94d63.js:3:19640\ncapacitor://localhost/js/chunk-vendors.48c94d63.js:24:8990","config":{"url":"URL","method":"post","data":"{\"page\":1}","headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json;charset=utf-8"},"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1}}
I saw that this error occurs only when I have parameters
axios.post("API CALL", {
lat: this.latitude,
lng: this.longitude,
page: this.page,
})
.then((response) => {
// console.log(response.data);
this.events = response.data;
this.loaded = true;
})
.catch(async (err) => {
console.log(err);
});
When removing parameters, no errors. Server side, the CORS settings are OK.
What’s the problem ?