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

268
Visualizações
How do I make a lot of api calls just once without slowing down the login process using nuxt

I'm currently working on a dashboard, and need to fetch a lot of info from APIs and make the info. available. And I need them to be available as soon as a user logs-in.

I'm using nuxt-auth for authentication and login.

Currently, I fetch the data on login, but it's making login take so long. And the more APIs I call, the longer it takes to log-in, and there are still a number of APIs to be consumed.

Making the API calls on mount of the concerned components seems really redundant.

Please recommend a better way to do this, that won't slow down the login time, and also allow me to make all the necessary API calls at once.

Vuejs,Nuxt.js, javascript.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If you are using nuxt-auth you should be able to make the api call in then callback, it will not affect the login process at all because it will run after login process is successful. And you can also call your api request without using await keyword if they doesn't depend on each other, all requests will process simultaneously.

      await this.$auth
        .loginWith("local", {
          data: {
            email: this.email,
            password: this.password
          }
        })
        .then(() => {
          this.$router.push("/");
          // write your api requests down here
        }).catch((err) => {})
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