Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

148
Vistas
Is there any way to get back to same page while canceling an asyncdata api call via browsers's back button

I have been using Nuxtjs and axios for API calls. In a page called post listing, once I select a post which suppose to navigate me to details page, while loading towards the page, once I click on browse's back button and try to get back to same listing page again without visiting the details page. It gives 404 and post not found error.

Is there any good way to prevent that?

Here is the code details page

async asyncData({ $api, route, $auth, error }) {
    try {
      // console.log(route.params)
      const { feed } = await $api.Feed.feedDetails(
        route.params.id,
        $auth.loggedIn
      )
      if (route.query.origin === 'channel') {
        const { channel } = await $api.Channels.channelDetails(
          route.query.cId,
          $auth.loggedIn
        )
        return { feed, channel_details: channel }
      } else {
        return { feed }
      }
    } catch (e) {
      error({ statusCode: 404, message: 'Feed not found' })
    }
  },

I have this middleware in the page details page

export default async function (context) {
  if (context.$auth.$state.loggedIn) {
    const params = {
      page: 1,
    }
    const { threads } = await context.$api.Messages.MessageThreadList(params)
    const { notifications } = await context.$api.Users.getNotifications({
      last_id: 0,
    })

    context.store.commit('addThreadList', threads)
    context.store.commit('addNotification', notifications)
  }
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda