0

私のアプリにログインするための認証を作成していますが、これらの3つの問題があり、進める方法がわかりません。問題を解決する方法について多くのことを知らない、私はまだそれを学んでいる、私のアプリケーションは、もはや画面が空白だけになって表示されませんこのプロセスを実行した後、チュートリアルは、ember簡単な認証のです:http://ember-simple-auth.com/ - :'ApplicationRouteMix'が定義されていますが使用されていません[Ember.js]

Could not start watchman 
Visit https://ember-cli.com/user-guide/#watchman for more info. 
Livereload server on http://localhost:49153 
'instrument' is imported from external module 'ember-data/-debug' but 
never used 

/home/carlos/www/vendasapi-frontend/app/controllers/login.js 
4:31 error 'session' is not defined no-undef 

✖ 1 problem (1 error, 0 warnings) 


/home/carlos/www/vendasapi-frontend/app/routes/application.js 
2:8 error 'ApplicationRouteMix' is defined but never used no- 
unused-vars 
5:35 error 'ApplicationRouteMixin' is not defined   no-undef 

✖ 2 problems (2 errors, 0 warnings) 


Build successful (4688ms) – Serving on http://localhost:4200/ 



Slowest Nodes (totalTime => 5%)    | Total (avg)   
----------------------------------------------+--------------------- 

Babel (20)         | 1481ms (74 ms)  
Rollup (1)         | 1352ms    
EslintValidationFilter (2)     | 703ms (351 ms)  
Concat (8)         | 545ms (68 ms)  

アプリ/コントローラ/ login.js

import Ember from 'ember'; 

export default Ember.Controller.extend({ 
session: Ember.inject.service(session), 

    actions: { 
    authenticate() { 
    let { identification, password } = 
this.getProperties('identification', 'password'); 

    this.get('session').authenticate('authenticator:oauth2', 
identification, password).catch((reason) => { 
    this.set('errorMessage', reason.error); 
     }); 

    } 

    } 

}); 

アプリ/コントローラ/

import Ember from 'ember'; 

export default Ember.Controller.extend({ 
    session: Ember.inject.service('session'), 

    actions: { 
    logout() { 
     this.get('session').invalidate(); 
    } 
} 
}); 

アプリ/路線/

import Ember from 'ember'; 
import ApplicationRouteMix from 
'ember-simple-auth/mixins/application-route-mixin'; 

export default Ember.Route.extend(ApplicationRouteMixin); 

答えて

0

をapplication.jsコンソール出力をapplication.js文字通り問題スペル:

  • /home/carlos/www/vendasapi-frontend/app/controllers/login.js 4:31 error 'session' is not defined no-undef

あなたはsession: Ember.inject.service(session)です。しかし、あなたはあなたがここで必要なもの...それにEmber.inject.serviceを呼び出すことはできませんので、定義されたセッション変数は、単に存在しないです:

session: Ember.inject.service('session') かさえ:

session: Ember.inject.service()

  • /home/carlos/www/vendasapi-frontend/app/routes/application.js 2:8 error 'ApplicationRouteMix' is defined but never used no- unused-vars 5:35 error 'ApplicationRouteMixin' is not defined no-undef

2行目でApplicationRouteMixとしてインポートしていますが、決してどこでも使用しているわけではありません。そして、5行目でApplicationRouteMixinを使用していますが、どこにも定義していません。あなたがタイプミスを持っているので、それはちょうどだ - あなたが使用することです:

import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';

+0

はすべての問題を解決し、私のアプリが再び働いている、感謝の男!! – Techtique

関連する問題