'use strict';

/**
 * Settings session controller.
 */
App.controller('SettingsSession', function($scope, Restangular) {
  /**
   * Load sessions.
   */
  $scope.loadSession = function() {
    Restangular.one('user').getList('session').then(function(data) {
      $scope.sessions = data.sessions;
    });
  };
  
  /**
   * Clear all active sessions.
   */
  $scope.deleteSession = function() {
    Restangular.one('user/session').remove().then(function() {
      $scope.loadSession();
    })
  };
  
  $scope.loadSession();
});