aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/rest
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/rest')
-rw-r--r--client/src/app/shared/rest/rest-extractor.service.ts14
1 files changed, 5 insertions, 9 deletions
diff --git a/client/src/app/shared/rest/rest-extractor.service.ts b/client/src/app/shared/rest/rest-extractor.service.ts
index 1b475da89..ad08a32f8 100644
--- a/client/src/app/shared/rest/rest-extractor.service.ts
+++ b/client/src/app/shared/rest/rest-extractor.service.ts
@@ -1,8 +1,7 @@
1import { HttpErrorResponse } from '@angular/common/http'
1import { Injectable } from '@angular/core' 2import { Injectable } from '@angular/core'
3import { dateToHuman } from '@app/shared/misc/utils'
2import { Observable } from 'rxjs/Observable' 4import { Observable } from 'rxjs/Observable'
3import { HttpErrorResponse } from '@angular/common/http'
4
5import { Utils } from '../utils'
6import { ResultList } from '../../../../../shared' 5import { ResultList } from '../../../../../shared'
7 6
8@Injectable() 7@Injectable()
@@ -16,7 +15,7 @@ export class RestExtractor {
16 const data: T[] = result.data 15 const data: T[] = result.data
17 const newData: T[] = [] 16 const newData: T[] = []
18 17
19 data.forEach(d => newData.push(fun.call(this, d, additionalArgs))) 18 data.forEach(d => newData.push(fun.apply(this, [ d ].concat(additionalArgs))))
20 19
21 return { 20 return {
22 total: result.total, 21 total: result.total,
@@ -29,12 +28,9 @@ export class RestExtractor {
29 } 28 }
30 29
31 convertDateToHuman (target: object, fieldsToConvert: string[]) { 30 convertDateToHuman (target: object, fieldsToConvert: string[]) {
32 const source = {} 31 fieldsToConvert.forEach(field => target[field] = dateToHuman(target[field]))
33 fieldsToConvert.forEach(field => {
34 source[field] = Utils.dateToHuman(target[field])
35 })
36 32
37 return Object.assign(target, source) 33 return target
38 } 34 }
39 35
40 handleError (err: HttpErrorResponse) { 36 handleError (err: HttpErrorResponse) {