I have a nativescript vue.js application that is hitting an endpoint to get a token when the user clicks login using axios.
when the emulator phone is offline the axios call is still made and the then is executed as if there was a successful request made, looking at the network tab there is a request made but it is pending forever and the axios call returns immediately.
if I run axios in a browser based application it does not seem to fail in the same way.
This is my calling code for:
methods:{
submit()
{ this.axios.post('https://backendauth.free.beeceptor.com/api/login',this.user)
.then((response) => {
console.log('Detected as a success')
console.log(response.status)
console.log(response)
console.log(response.data.success.token)
this.data = JSON.stringify(response.data)
this.$navigateTo(this.$router['home'])
}).catch((err)=>{
if (err.response.status === 401) {
console.log(err)
}
else
{
console.log(err.response)
}
})
this.submitting = 'form clicked'
}
I have created a repo that demonstrates this
https://github.com/jachno/basicAuth
This image shows the console request being successful with the device online
and this shows the call working over the network
And this shows the network pending request when it is in flight mode
This now shows what the console looks like when the device in in flight mode:



