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();
}
});
}]
});