Add Client.getGroups()

This commit is contained in:
Johannes Zellner
2016-02-10 14:25:08 +01:00
parent 459d5b8f60
commit 19982b1815

View File

@@ -392,6 +392,13 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification',
}).error(defaultErrorHandler(callback));
};
Client.prototype.getGroups = function (callback) {
$http.get(client.apiOrigin + '/api/v1/groups').success(function (data, status) {
if (status !== 200 || typeof data !== 'object') return callback(new ClientError(status, data));
callback(null, data.groups);
}).error(defaultErrorHandler(callback));
};
Client.prototype.getNonApprovedApps = function (callback) {
if (!this._config.developerMode) return callback(null, []);