sum7/warehost-frontend
sum7
/
warehost-frontend
Archived
1
0
Fork 0
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.
warehost-frontend/public/app/main.js

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 = {};
});
};
});