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

118
Visualizações
cancel/interupt reqeust AXIOS request

maybe it's a simple question.

I want to ask how to interrupt axios request in nuxt/vue.

this is my scenarios:

  1. I am in page Profile with a HTTP request getProfile and getFullProfile, getProfile request success resolved with but getFullProfile request not yet resolved.
  2. Move to product page, the request getFullProfile still waiting response

what i expect

  1. I am in page Profile with a HTTP request getProfile and getFullProfile, getProfile request success resolved with but getFullProfile request not yet resolved.
  2. Move to product page, the request getFullProfile interupt/cancel

I am using axios as a plugin, this is my config

// plugins/axios.js

 app.$axios.setHeader('accept-encoding', null)
    app.$axios.setHeader('Content-Type', 'application/json')
    app.$axios.setHeader('Authorization', token)
    app.$axios.onError(async error => {
        if (typeof error.response !== "undefined") {
            if (error.response.status === 401) {
                jscookie.set("fallback_url", window.$nuxt.$route.path)
                jscookie.remove('token');
                window.location.href = '/logout'
                return
            }
            return Promise.reject(error);
        } else {
            throw error
        }
    })

Thank you

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