Add Angular factory to get and save Monitors

This commit is contained in:
Kyle Johnson 2014-12-21 21:42:54 -05:00
parent de221f4d57
commit 44a44580b7
1 changed files with 16 additions and 0 deletions

View File

@ -8,6 +8,22 @@ ZoneMinder.config(['$locationProvider', function($locationProvider){
$locationProvider.html5Mode(true);
}]);
ZoneMinder.factory('Monitor', function($http) {
return {
getMonitor: function(mid) {
return $http.get('/api/monitors/'+mid+'.json');
},
saveMonitor: function(monitor) {
return $http({
method: 'POST',
url: '/api/monitors.json',
data: $.param(monitor),
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
});
}
};
});
ZoneMinder.factory('Header', function($http) {
return {
getLogState: function(callback) {