JS: Fix scrutinizer warnings and indentation for services

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2017-10-04 15:38:08 +02:00
committed by Julius Härtl
parent 9014ae1490
commit 320f2bf5c8
3 changed files with 192 additions and 193 deletions

View File

@@ -20,6 +20,7 @@
* *
*/ */
/** global: oc_defaults */
app.factory('ApiService', function ($http, $q) { app.factory('ApiService', function ($http, $q) {
var ApiService = function (http, endpoint) { var ApiService = function (http, endpoint) {
this.endpoint = endpoint; this.endpoint = endpoint;
@@ -57,7 +58,7 @@ app.factory('ApiService', function($http, $q){
var self = this; var self = this;
$http.get(this.baseUrl + '/' + id).then(function (response) { $http.get(this.baseUrl + '/' + id).then(function (response) {
data = response.data; var data = response.data;
if (self.data[data.id] === undefined) { if (self.data[data.id] === undefined) {
self.data[data.id] = response.data; self.data[data.id] = response.data;
} }
@@ -149,7 +150,6 @@ app.factory('ApiService', function($http, $q){
}; };
ApiService.prototype.getData = function () { ApiService.prototype.getData = function () {
return $.map(this.data, function (value, index) { return $.map(this.data, function (value, index) {
return [value]; return [value];

View File

@@ -20,6 +20,7 @@
* *
*/ */
/** global: OC */
app.factory('BoardService', function (ApiService, $http, $q) { app.factory('BoardService', function (ApiService, $http, $q) {
var BoardService = function ($http, ep, $q) { var BoardService = function ($http, ep, $q) {
ApiService.call(this, $http, ep, $q); ApiService.call(this, $http, ep, $q);
@@ -215,7 +216,6 @@ app.factory('BoardService', function(ApiService, $http, $q){
return false; return false;
}; };
service = new BoardService($http, 'boards', $q); return new BoardService($http, 'boards', $q);
return service;
}); });

View File

@@ -25,6 +25,5 @@ app.factory('LabelService', function(ApiService, $http, $q){
ApiService.call(this, $http, ep, $q); ApiService.call(this, $http, ep, $q);
}; };
LabelService.prototype = angular.copy(ApiService.prototype); LabelService.prototype = angular.copy(ApiService.prototype);
service = new LabelService($http, 'labels', $q); return new LabelService($http, 'labels', $q);
return service;
}); });