mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 15:56:05 -07:00
angular
This commit is contained in:
parent
a19e81d1f8
commit
c764d6557a
17 changed files with 765 additions and 513 deletions
|
@ -0,0 +1,36 @@
|
|||
(function () {
|
||||
|
||||
var controller = function ($scope, userManagementService) {
|
||||
|
||||
$scope.user = {}; // The local user to create
|
||||
$scope.users = []; // list of users
|
||||
|
||||
$scope.error = false;
|
||||
$scope.errorMessage = {};
|
||||
|
||||
$scope.getUsers = function () {
|
||||
$scope.users = userManagementService.getUsers()
|
||||
.then(function (data) {
|
||||
$scope.users = data.data;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.addUser = function () {
|
||||
if ($scope.users.length === 0) {
|
||||
$scope.getUsers();
|
||||
}
|
||||
userManagementService.addUser($scope.user).then(function (data) {
|
||||
if (data.message) {
|
||||
$scope.error = true;
|
||||
$scope.errorMessage = data.message;
|
||||
} else {
|
||||
$scope.users.push(data);
|
||||
$scope.user = {};
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
angular.module('PlexRequests').controller('userManagementController', ["$scope", "userManagementService", controller]);
|
||||
|
||||
}());
|
Loading…
Add table
Add a link
Reference in a new issue