diff --git a/src/app/modules/time-clock/services/entry.service.spec.ts b/src/app/modules/time-clock/services/entry.service.spec.ts index 230e86a32..ed4191c0b 100644 --- a/src/app/modules/time-clock/services/entry.service.spec.ts +++ b/src/app/modules/time-clock/services/entry.service.spec.ts @@ -40,12 +40,21 @@ describe('EntryService', () => { }); it('loads an activeEntry with /running', () => { + service.urlInProduction = true; service.loadActiveEntry().subscribe(); const loadEntryRequest = httpMock.expectOne(`${service.baseUrl}/running`); expect(loadEntryRequest.request.method).toBe('GET'); }); + it('loads an activeEntry with /active/{userId}', () => { + service.urlInProduction = false; + service.loadActiveEntry().subscribe(); + + const loadEntryRequest = httpMock.expectOne(`${service.baseUrl}/active/2`); + expect(loadEntryRequest.request.method).toBe('GET'); + }); + it('loads summary with get /summary?time_offset=', () => { service.summary().subscribe(); const timeOffset = new Date().getTimezoneOffset(); diff --git a/src/app/modules/time-clock/services/entry.service.ts b/src/app/modules/time-clock/services/entry.service.ts index 5c8a9b28c..12915e192 100644 --- a/src/app/modules/time-clock/services/entry.service.ts +++ b/src/app/modules/time-clock/services/entry.service.ts @@ -19,9 +19,17 @@ export class EntryService { static TIME_ENTRIES_DATE_TIME_FORMAT = 'yyyy-MM-ddTHH:mm:ssZZZZZ'; baseUrl = `${environment.timeTrackerApiUrl}/time-entries`; + urlInProduction = environment.production; loadActiveEntry(): Observable { - return this.http.get(`${this.baseUrl}/running`); + let path = ''; + + if (this.urlInProduction){ + path = `${this.baseUrl}/running`; + }else{ + path = `${this.baseUrl}/active/2`; + } + return this.http.get(path); } loadEntries(date): Observable {