Ember JS – transitionTo route and then display Feedback message

Since i am a bit newbie and just starting doing some frontend, i am having an issue with EmberJS transitionTo().
The problem is that when i click "delete" inside details of the product, it displays the feedback message there, and then it transits to the home page.
I want to transit first to home page if i am at details, and then display the feedback message.

the code i have:

delete: function(system,) {
  const self = this;
  this.get('data').del(systemId)
    .then(function() {
      self.transitionTo('home');
      self.setFeedbackSuccess(self.currentModel, self.get('intl').t('delete.success'));
    }).then(() => self.refresh())
    .then(() => {
      self.transitionTo('home');
      self.setFeedbackSuccess(self.currentModel, self.get('intl').t('delete.success'));
    })
    .catch((errorObject) => {..})
    .catch((errorObject) => self.errorHandler(errorObject, self.currentModel));
},

The first call to the function is where the feedback is displayed at the detail page, if i remove it from there, after .then(() => self.refresh()) it will show nothing from feedback, unless i am at the home page, and delete from there.

Leave a Comment