Use restangular#withConfig to initialize uncached provider

pull/4239/head
Oliver Günther 9 years ago
parent 0a144eeb57
commit 0fd5e4710c
  1. 8
      frontend/app/components/api/api-work-packages/api-work-packages.service.ts
  2. 2
      frontend/app/components/routing/wp-list/wp-list.controller.ts

@ -35,7 +35,7 @@ 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) {
workPackages = uncachedProvider.service('work_packages', this.apiV3.one('projects', query.projectId));
@ -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) => {

@ -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) => {

Loading…
Cancel
Save