簡體   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