0
私はログインシステムを持っています。ここでは、localstorage上のログインユーザーをkeeeしなければなりません。そして、ユーザーログを取得したら、ログインページにアクセスするたびに彼自身のページにリダイレクトします。なぜ私の財産は鉄のローカルストレージの値を反映しませんか?
マイテンプレート:
<iron-localstorage name="user-storage" value="{{storedUser}}"></iron-localstorage>
マイオブジェクト:
static get properties() {
return {
storedUser: {
type: Object,
notify: true
},
...
}
}
が、私はこれをしたい:
redirect() {
console.log(this.storedUser);
if(this.storedUser) {
// Redirect user or admin to their own homescreen
if(this.storedUser.role == 'user')
this.set('route.path', '/homescreen-usuario');
else if(this.storedUser.role == 'admin')
this.set('route.path', '/homescreen-admin');
else
this.set('route.path', '/my-view404');
}
}
しかし、最初の行は、常に "未定義" ログに記録します。