iegorov
2/11/2017 - 10:01 AM

Connecting to store

Connecting to store

const disposables = [];
 
 addDisposables();

function addDisposables() {
  disposables.push(
    userStore.user
      .subscribe((master) => { vm.master = master; }),

    userStore.error
      .subscribe((error) => {
        if (error.status === 404) {
          Utils.showErrorPage(error.status, 'Такой мастер не найден.');
          return;
        }
        Utils.showErrorPage(error.status, MESSAGES['ERROR_' + error.status]);
      })
  );
}

this.$onDestroy = function() {
  disposables.forEach(disposable => disposable.dispose());
};