vue-router: [next] beforeRouteEnter : vm is undefined inside promise

Hi,

I’m experiencing a weird issue when using vue-router@2.0. According to : release docs, I’m trying to fetch data with a random API (no matter witch API I use) but the vm callback is undefined. In the other hand when I’m logging vm without using a request promise, vm is defined.

beforeRouteEnter(route, redirect, next) {

    return superagent
    .get(PATH_API + PATH_PROJECTS)
    .end((err, res) => {

        next(vm => {

            // Here vm is undefined 
            console.log(vm);

        });

    });
}
beforeRouteEnter(route, redirect, next) {
    next(vm => {

        // Here vm is defined 
        console.log(vm);

    });
}

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 20 (9 by maintainers)

Most upvoted comments

If you need me to provide repro just ask me then and I will be delighted to do so. Therefor you should be aware that closing an issue than can be relevant for other people without even waiting for my feedback regarding your answer cannot be acceptable.

If you need me to provide repro just ask me then and I will be delighted to do so.

The Issue Guidelines that appear when you open an issue clearly state that we want/need a reproduction.

Please understand that if we leave open every issue that has no reproduction and doesn’t appear to be a bug from the information that was provided (event hough yours may indeed be a bug), the issue list would get very crowded.

We close those issues to keep the list manageable - yet we don’t lock those issues, so the authors can provide further info that may warrant a reopening of the issue - like it happened here.