Skip to content

Commit

Permalink
Step 4.24: Add settings controller
Browse files Browse the repository at this point in the history
  • Loading branch information
DAB0mB authored and Dotan Simha committed Nov 23, 2016
1 parent c469df4 commit 9f09f7d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions client/scripts/controllers/settings.controller.js
@@ -0,0 +1,23 @@
import { Meteor } from 'meteor/meteor';
import { Controller } from 'angular-ecmascript/module-helpers';

export default class SettingsCtrl extends Controller {
logout() {
Meteor.logout((err) => {
if (err) return this.handleError(err);
this.$state.go('login');
})
}

handleError (err) {
this.$log.error('Settings modification error', err);

this.$ionicPopup.alert({
title: err.reason || 'Settings modification failed',
template: 'Please try again',
okType: 'button-positive button-clear'
});
}
}

SettingsCtrl.$inject = ['$state', '$ionicPopup', '$log'];

0 comments on commit 9f09f7d

Please sign in to comment.