Static GitHub Issues

[1739] problems with beforeRouteEnter

prev: Async data in layout?
next: wish: defining middleware functions in component

Hi, I have a code:

<script>
  import ContactList from 'src/components/ContactList/ContactList.vue';

  export default {
    components: {
      'kr-contact-list': ContactList,
    },
    beforeRouteEnter(to, from, next) {
      next('/login');
    }
  };
</script>

and I get a error: Cannot read property 'serverRendered' of undefined how to fix it? should I use middleware for it?

<!--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/c1560">#c1560</a>)</em></sub></div>