vuejs-templates / pwa

PWA template for vue-cli based on the webpack template
MIT License
3.04k stars 506 forks source link

POST API not calling on mobile [Chrome v72.0.*] #206

Closed iashraful closed 5 years ago

iashraful commented 5 years ago

Problem

When I'm trying on web[Desktop/Laptop] browser it's working fine for me. But when I'm trying on PWA mode on my phone[Chrome 72.0.3625.105] version. Then, it's not calling the API. I have tested so many ways. I found everything is working except the POST API call.

I have written code like following,

loginSubmit() {
    fetch('http://my-server.com/api/login/', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json'
        },
        body: JSON.stringify(this.formData)
    }).then((response) => {
        return response.json()
    }).then((data) => {
        console.log(data)
        alert(data.success)
    })
}

Please let me know if I'm doing any mistakes

UPDATE It says network error. But I have active internet connection

iashraful commented 5 years ago

I found the issue. It was related to my wifi router and localhost.