Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins.js:2 TypeError: Cannot read property 'next' of undefined #7

Open
stefensuhat opened this issue Aug 9, 2016 · 1 comment
Open

Comments

@stefensuhat
Copy link

stefensuhat commented Aug 9, 2016

Hi,

I always get those error when setup the middleware. here is my code:

 $middlewareProvider.map({ 

            'check-token': ['Auth', (Auth) => {
                const request = this;
                Auth.get({ url: 'check-token' }, response => {
                    if (response) {
                        return request.next();
                    }
                });
            }]
        });
@karlhepler karlhepler added the bug label Aug 10, 2016
@karlhepler
Copy link
Owner

I haven't tried it yet, but it looks like you are using those new fancy arrow functions, which implicitly binds "this" to the parent object. I think, but I'm not sure without checking, that "this" is actually referencing the map object and not the request. Give it a try without the arrow functions and let me know. I'll be happy to look into it more if that's not the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants