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

33 lines
737 B
JavaScript
Raw Normal View History

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 = {};
2016-09-03 13:24:54 +02:00
$scope.modules = [];
2016-08-14 13:37:26 +02:00
$scope.$state = $state;
2016-09-03 13:24:54 +02:00
$http.get(config.api+'/modules').then(function(res){
session.set(res);
alert.set(res);
$scope.modules = res.data.data;
});
2016-08-14 13:37:26 +02:00
$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 = {};
});
};
});