Проблема с пакетом aurelia-auth - невозможно прочитать свойство filter из undefined

Я пытаюсь использовать пакет aurelia-auth в своем проекте Aurelia, но получаю ошибку в названии.

main.js

import 'bootstrap';
import config from './auth-config';

export function configure(aurelia) {
  aurelia.use
    .standardConfiguration()
    .developmentLogging()
    .plugin('aurelia-auth', (baseConfig) => {
         baseConfig.configure(config);
    });

  aurelia.start().then(() => aurelia.setRoot());
}

app.js

import 'bootstrap';

import {inject} from 'aurelia-framework';  
import {Router} from 'aurelia-router';  
import {FetchConfig} from 'aurelia-auth';

// with the @inject decorator
@inject(Router, FetchConfig)

export class App {

  configureRouter(config, router) {
    config.title = 'Aurelia';
    config.map([
      { route: ['', 'welcome'], name: 'welcome',      moduleId: 'welcome',      nav: true, title: 'Welcome' },
      { route: 'users',         name: 'users',        moduleId: 'users',        nav: true, title: 'Github Users' },
      { route: 'child-router',  name: 'child-router', moduleId: 'child-router', nav: true, title: 'Child Router' }
    ]);

    this.router = router;
  }

  constructor(router, fetchConfig) {
    this.router = router;
    this.fetchConfig = fetchConfig;
  };

  activate() {
    this.fetchConfig.configure();
  };
}

И вот ошибка в полном объеме:

bluebird.min.js:31 Unhandled rejection TypeError: Cannot read property 'filter' of undefined
    at AuthFilterValueConverter.toView (http://localhost:9000/jspm_packages/npm/aurelia-auth@3.0.5/auth-filter.js:21:21)
    at ValueConverter.evaluate (http://localhost:9000/jspm_packages/npm/aurelia-binding@1.0.9/aurelia-binding.js:1299:33)
    at Binding.bind (http://localhost:9000/jspm_packages/npm/aurelia-binding@1.0.9/aurelia-binding.js:4785:41)
    at Controller.bind (http://localhost:9000/jspm_packages/npm/aurelia-templating@1.1.1/aurelia-templating.js:3403:19)
    at View.bind (http://localhost:9000/jspm_packages/npm/aurelia-templating@1.1.1/aurelia-templating.js:1463:24)
    at Controller.bind (http://localhost:9000/jspm_packages/npm/aurelia-templating@1.1.1/aurelia-templating.js:3425:19)
    at View.bind (http://localhost:9000/jspm_packages/npm/aurelia-templating@1.1.1/aurelia-templating.js:1463:24)
    at Controller.bind (http://localhost:9000/jspm_packages/npm/aurelia-templating@1.1.1/aurelia-templating.js:3425:19)
    at Controller.automate (http://localhost:9000/jspm_packages/npm/aurelia-templating@1.1.1/aurelia-templating.js:3370:12)
    at eval (http://localhost:9000/jspm_packages/npm/aurelia-templating@1.1.1/aurelia-templating.js:4428:20)
    at r (http://localhost:9000/jspm_packages/npm/bluebird@3.4.1/js/browser/bluebird.min.js:33:7722)
    at i._settlePromiseFromHandler (http://localhost:9000/jspm_packages/npm/bluebird@3.4.1/js/browser/bluebird.min.js:32:13044)
    at i._settlePromise (http://localhost:9000/jspm_packages/npm/bluebird@3.4.1/js/browser/bluebird.min.js:32:13847)
    at i._settlePromise0 (http://localhost:9000/jspm_packages/npm/bluebird@3.4.1/js/browser/bluebird.min.js:32:14548)
    at i._settlePromises (http://localhost:9000/jspm_packages/npm/bluebird@3.4.1/js/browser/bluebird.min.js:32:15878)
    at i._fulfill (http://localhost:9000/jspm_packages/npm/bluebird@3.4.1/js/browser/bluebird.min.js:32:14919)

И строка, к которой это относится в jspm-packages\github\paulvanbladel\aurelia-auth@3.0.5\auth-filter.js:

AuthFilterValueConverter.prototype.toView = function toView(routes, isAuthenticated) {
  return routes.filter(function (r) { // This is the line the error is occurring 
    return r.config.auth === undefined || r.config.auth === isAuthenticated;
  });
};

Есть ли проблема с пакетом или я делаю что-то не так?

0 ответов

Другие вопросы по тегам