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

153
Visualizações
Vue axios call is claiming argument is null when should be an array

In my vue component I have a data array

data: {
  categories: [{id:1, title: "category 1"},{id:2, title: "category 2"}]
}

and I'm trying to load this in as a data argument in an axios call

axios({
  method: 'get',
  url: //testURL,
  data: {
    categoryCall: this.categories
  }
}).then(function (response){
  console.log(response);
}).catch(function (error){
  console.log(error.response);
});

but I'm getting a 400 bad request code where it tells me that argument 1 should be an array and null is given.

Am I not properly passing in the already established array in the axios call? Where am I going wrong?

var vm = 
new Vue({
  el: "#app",
  data: {
    categories: [
    {id:1, title: "category 1"},
    {id:2, title: "category 2"}
    ]
  },
  methods: {
    submit_axios(){
    
        axios({
            method: 'get',
            url: //test,
            data: {
              categories: this.categories
            }

        }).then(function (response) {
            console.log(response);

        }).catch(function (error) {
            console.log(error.response);
        });
    }
  }
  
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
   <button  @click="submit_axios()">Search</button>
</div>

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