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

100
Visualizações
Vue async request on every 10 sec with spinning wheel

I'm from Ruby language so sorry for noob question. I would like to have asynchronous fetching of data to a table that comes from endpoint from my Rails backend application. I would like the data to be fetched live i.e. if a new record is created the result should be displayed in the table. To achieve that probably I need to send a GET request e.g. every 15 seconds and when the data is downloaded I would like to let you know that the app is doing it (add some sort of spinning wheel?).

What I have:

imports.js

const fetchSyncedProductsResultRequest = (token) => {
  return axios
    .get(`/api/v1/imports/products/sync_result`, {
      headers: {
        Authorization: `Bearer ${token}`,
      }
    })
    .then(response => {
      return response.data['products']
    })
};

sync_products.vue

<script>

import {
  fetchSyncedProductsResultRequest,
} from '../../api/imports'

export default {
  name: 'BackboneSyncProducts',
  data() {
  async mounted() {
    await fetchSyncedProductsResultRequest(this)
    this.syncedProductsFetched = true
    this.pageChanged(this.currentPage)
  },
  async mounted() {
    const jwtToken = this.$store.state.idToken;
    fetchSyncedProductsResultRequest(jwtToken).then(data => {
      this.fetchedProductSyncStatus = data
    })
  },

</script>

How to send this request every 15 seconds only when the user is on a page with sync_products.vue content and when the fetching is in progres display some spinning wheel?

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