summaryrefslogtreecommitdiffstats
path: root/js/service
diff options
context:
space:
mode:
authorMarco Nassabain <marco.nassabain@etu.unistra.fr>2020-12-27 18:32:20 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-04-08 23:17:31 +0200
commit5a9f8ff770fac583dbb2bedf697f34fb65528a3a (patch)
treeb93003273871f51f149bf87bc7cc8f05d68a136a /js/service
parent8639f9fb36021880d9b1ae93a1e6a7fcd0ab9b58 (diff)
✨ added UserResource with getUsers function
Signed-off-by: Marco Nassabain <marco.nassabain@hotmail.com>
Diffstat (limited to 'js/service')
-rw-r--r--js/service/UserResource.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/js/service/UserResource.js b/js/service/UserResource.js
new file mode 100644
index 000000000..817c9e9cd
--- /dev/null
+++ b/js/service/UserResource.js
@@ -0,0 +1,26 @@
+/**
+ * Nextcloud - News
+ *
+ * @author Marco Nassabain <marco.nassabain@hotmail.com>
+ */
+app.factory('UserResource', function (Resource, $http, BASE_URL) {
+ 'use strict';
+
+ var UserResource = function ($http, BASE_URL) {
+ Resource.call(this, $http, BASE_URL);
+ };
+
+ UserResource.prototype = Object.create(Resource.prototype);
+
+ UserResource.prototype.getUsers = function (search) {
+ return this.http({
+ url: OC.linkToOCS(`cloud/users?search=${search}&offset=0&limit=5`, 2),
+ method: 'GET',
+ }).then(function(response) {
+ return response.data;
+ });
+ };
+
+
+ return new UserResource($http, BASE_URL);
+}); \ No newline at end of file