26 lines
577 B
JavaScript
26 lines
577 B
JavaScript
'use strict';
|
|
|
|
angular.module('warehost')
|
|
.controller('MainCtrl',function($scope,alert,$http,$state,config,session){
|
|
$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);
|
|
alert.set(res);
|
|
});
|
|
};
|
|
$scope.login = function(){
|
|
$http.post(config.api+'/login',$scope.obj).then(function(res){
|
|
session.set(res);
|
|
alert.set(res);
|
|
$scope.obj = {};
|
|
});
|
|
};
|
|
});
|