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

159
Visualizações
Manipulating API in Vue methods

I have a method that is making 2 API calls simultaneously. How can I take the results of the API calls and manipulate them in another method within the same Vue component.

 buildChart(){
    *method where calls would be manipulated"

}
     async updateChart() {
        this.isLoading = true;
        const apiCall1 = await get().then((result) => {
          console.log(result);
          this.isLoading = false;
        });
        const apiCall2= await get().then((result) => {
          console.log(result);
          this.isLoading = false;
        });
      }
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use Promise.all to execute the two requests in parallel, the result will be an array of two items of each async request.

async buildChart(){
  // here result will be an array with two items of the result of each async get method.
  const [firstRequest, secondRequest] = await updateChart()
  this.isLoading = false;
},
updateChart() {
  this.isLoading = true;
  return Promise.all([get(), get()])
}

about 4 years ago · Juan Pablo Isaza Relatório
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