Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

211
Visualizações
Axios post requests are not working with Cordova in Quasar

It's really weird. I opened the dev server of my quasar app and everything works fine. GET requests also work, POST requests also work with my server (Hosted). I use the Axios package to do so. But when I build the app for android using Cordova, only GET requests work, when I test with my phone.

To realize what's happening: I used a ref. So when the app starts the data coming from the GET request is stored in a ref. So if the ref is true the data display in a <p> tag since there is no console option in the mobile app to check the returned data. It's working the data is being rendered from the GET request. I did the same thing to test the POST request, I made a form, and after submit the data is going to the server, and returning back data will be stored in a ref too. I have another <p> tag to render that data (which shows if the ref is true). However this is not happening, the POST request doesn't work at all I checked the PHPMyAdmin in the server too no data has been inserted.

I'm really struggling with this. Really appreciate it if somebody could help me with this. Why POST requests are not working with Cordova after build and only working with the web?. I have attached my code below. Thanks.

<template>
  <q-page class="flex flex-center">
    <q-form @submit.prevent="registerUser" class="q-gutter-md">
      <q-input
        type="text"
        autofocus
        v-model="userForm.username"
        label="Username"
        color="info"
      />
    </q-form>
    <p v-if="userData">{{userData }}</p>
  </q-page>
</template>

<script setup>
import { ref, reactive } from "vue";

const userData = ref();

const userForm = reactive({
 username: '',
});

const registerUser = async () => {
  await axios
    .post(`urlhere/register_app_user`, userForm)
    .then((response) => {
      userData.value = response.data;
    });
};
</script>

However, this POST request works on the web. But after I build it to android using Cordova it doesn't work. I use Laravel for backend

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda