Static GitHub Issues

[608] Manually triggering `asyncData`

prev: Cannot commit to vuex store on ssr
next: how can i use less in nuxt?

Greetings.

I have a page which content I fetch with asyncData and I need to fetch that content again once a sign-in event happens:

export default {
  async asyncData ({ params }) {
    const res = await http.get(`/api/workshop/${params.id}/`)
    return {workshop: res.data.response}
  },
  computed: {
    ...mapGetters(['isAuthenticated'])
  },
  watch: {
    isAuthenticated () {
      // trigger asyncData again   <-----------
    }
  },

Redirecting to the same page after a successful sign-in would also work for me but something like

this.$router.replace(this.$router.currentRoute.path)

also doesn't work for me.

Can someone guide me what should I do (what am I going wrong) ?

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c528">#c528</a>)</em></sub></div>