Using the last framework7 version 7.0 I tried many times to make a request inside the store.js but I end with errors in android
in the store.js I add this line at the top
import { createStore, getDevice, request} from 'framework7';
then I can use the request that works in IOS perfectly! but in android I receive many errors so I have to call the api using xhr XMLHttpRequest and works but I want both to use the same call.
I am using Android 11, 12 version with Cordova android 11 installed version
cordova platform add [email protected]
this is the request
request({
headers: {
'Content-Type': 'application/json',
},
url: https://....,
dataType: 'json',
async: true,
method: 'POST',
data: JSON.stringify(data),
cache: false,
crossDomain: true,
})
.then((res) => {
console.log( {all_products: res.data});
}).catch(function (err) {
if (retries > 0 && retryCodes.includes(status)) {
setTimeout(() => {
console.log("retrying: getting products... retries left... " + retries);
resolve(store.dispatch('getProducts', {
$f7, $,
retries: retries - 1,
backoff: backoff * 2
}));
}, 500);
} else {
...
}
})
this works perfectly in iOS but in android device I get this error:
POST https://.../v3/products 502
index.eb6287a6.js:176 Error
... at XMLHttpRequest.f.onload (index.eb6287a6.js:24)
even if I use $f7.request.post for android the same error
POST https://.../v3/products 502
index.eb6287a6.js:176 Error
... at XMLHttpRequest.f.onload (index.eb6287a6.js:24)
any ideas why in android it does not work the same request as in iOS?
is there any fix for this?
thanks