diff --git a/frontend/app/components/api/api-work-packages/api-work-packages.service.ts b/frontend/app/components/api/api-work-packages/api-work-packages.service.ts index eb3a052821..7a3eb99e2f 100644 --- a/frontend/app/components/api/api-work-packages/api-work-packages.service.ts +++ b/frontend/app/components/api/api-work-packages/api-work-packages.service.ts @@ -35,9 +35,9 @@ export class ApiWorkPackagesService { public list(offset:number, pageSize:number, query:api.ex.Query) { var workPackages; - var uncachedProvider = this.apiV3.setDefaultHttpFields({cache: false}); + var uncachedProvider:restangular.IService = this.uncachedAPI(); - if (query.projectId) { + if (query.projectId) { workPackages = uncachedProvider.service('work_packages', this.apiV3.one('projects', query.projectId)); } else { @@ -47,6 +47,12 @@ export class ApiWorkPackagesService { return workPackages.getList(this.queryAsV3Params(offset, pageSize, query)); } + private uncachedAPI():restangular.IService { + return this.apiV3.withConfig(function(RestangularConfigurer) { + RestangularConfigurer.setDefaultHttpFields({ cache: false }); + }); + } + protected queryAsV3Params(offset:number, pageSize:number, query:api.ex.Query) { const v3Filters = _.map(query.filters, (filter:any) => { diff --git a/frontend/app/components/routing/wp-list/wp-list.controller.ts b/frontend/app/components/routing/wp-list/wp-list.controller.ts index e237e776ee..509fe3ac8c 100644 --- a/frontend/app/components/routing/wp-list/wp-list.controller.ts +++ b/frontend/app/components/routing/wp-list/wp-list.controller.ts @@ -211,7 +211,7 @@ function WorkPackagesListController($scope, wpListService.fromQueryInstance($scope.query, $scope.projectIdentifier) .then(function (json:api.ex.WorkPackagesMeta) { - var rowLookup = _.indexBy($scope.rows, row => row.object.id); + var rowLookup = _.indexBy($scope.rows, (row:any) => row.object.id); // Merge based on id and lockVersion angular.forEach(json.work_packages, (fresh, i) => {