Find method could not recall ajax


#1

Hi,

I have an problem, my model function wouldn’t called. So my problem, I have on backend an route ‘api/accounts/me’ that give information about the current account. If I call the logout method and the session route would called again, there would be no ajax called.

SessionRoute

  model: function(){
    return this.store.find('account','me');
  }

SessionController

  actions: {

    logout: function(){

      var api_key = window.sessionStorage.getItem("API_KEY");

      var _this = this;

      $.ajax( App.API_HOST + "/api/logout", {
        headers: { 'API_KEY': api_key },
        contentType : 'application/json',
        type : 'GET',
        success: function(){
          window.sessionStorage.clear();
          _this.set('authenticated', false);
          _this.transitionToRoute('index');
        },
        error: function(error){
            console.log('session.js controller ajax.error: ',error);
        }
      });
    },

  }