This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
2016-08-14 13:37:26 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
angular.module('warehost')
|
2016-08-17 22:35:25 +02:00
|
|
|
.controller('MainCtrl',function($scope,alert,$http,$state,config,session){
|
2016-08-14 13:37:26 +02:00
|
|
|
$scope.isOpen = false;
|
|
|
|
$scope.obj = {};
|
|
|
|
$scope.$state = $state;
|
|
|
|
|
|
|
|
$scope.toggleOpen = function(){
|
|
|
|
$scope.isOpen = !$scope.isOpen;
|
|
|
|
};
|
|
|
|
$scope.logout = function(){
|
|
|
|
$http.get(config.api+'/logout').then(function(res){
|
|
|
|
session.set(res);
|
2016-08-17 22:35:25 +02:00
|
|
|
alert.set(res);
|
2016-08-14 13:37:26 +02:00
|
|
|
});
|
|
|
|
};
|
|
|
|
$scope.login = function(){
|
|
|
|
$http.post(config.api+'/login',$scope.obj).then(function(res){
|
|
|
|
session.set(res);
|
2016-08-17 22:35:25 +02:00
|
|
|
alert.set(res);
|
2016-08-14 13:37:26 +02:00
|
|
|
$scope.obj = {};
|
|
|
|
});
|
|
|
|
};
|
|
|
|
});
|