繁体   English   中英

灰烬未捕获的错误:试图处理事件`didSetProperty`

[英]Ember Uncaught Error: Attempted to handle event `didSetProperty`

我收到此错误,似乎是在销毁我的“ auth”逻辑上的会话时。 我已经阅读了所有可以找到的东西,这似乎与被破坏对象的值有关,但是我已经尝试了所有发现的东西,但是没有运气。 如果有人能为我指出正确的解决方案,我将不胜感激。

错误

未捕获的错误:试图处理事件didSetProperty上,而在状态root.deleted.saved。 用{name:email,oldValue:undefined,originalValue:undefined,value:test@test.com}进行调用。

调节器

App.ApplicationController = Ember.ObjectController.extend
  actions:
    signOut: ->
      @get('model').destroyRecord().then =>
        $.removeCookie 'apiKey'
        @set 'model', @store.createRecord 'session'
        @transitionToRoute 'sign-in'
      , ->
        @transitionToRoute 'sign-in'

路线

App.ApplicationRoute = Ember.Route.extend
  model: ->
    if !$.cookie 'apiKey'
      @store.createRecord 'session'
    else
      @store.find('session', 'current').then (session)->
        session

会话模型

App.Session = DS.Model.extend
  access_token: DS.attr()
  email: DS.attr()
  password: DS.attr()
  isLoggedIn: Ember.computed.notEmpty 'access_token'
  user: DS.belongsTo 'user', embedded: 'always'

App.SessionSerializer = DS.ActiveModelSerializer.extend DS.EmbeddedRecordsMixin,
  attrs: user: embedded: 'always'

很晚了,抱歉。

解决销毁模型的承诺后,将在模型上设置某些内容-在这种情况下为会话记录。 请注意, @get('model').destroyRecord()命令后跟@set 'model'命令。

这就是为什么错误消息while in state root.deleted.saved

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM