Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: TT-443 Fix url in prod
  • Loading branch information
gcobena-dev committed Dec 21, 2021
commit 9df4cee9b15108a0006c0d906132de8489524482
4 changes: 2 additions & 2 deletions src/app/modules/time-clock/services/entry.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ describe('EntryService', () => {
});

it('loads an activeEntry with /running', () => {
service.showOptionInDevelopment = true;
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.showOptionInDevelopment = false;
service.urlInProduction = false;
service.loadActiveEntry().subscribe();

const loadEntryRequest = httpMock.expectOne(`${service.baseUrl}/active/2`);
Expand Down
7 changes: 4 additions & 3 deletions src/app/modules/time-clock/services/entry.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TimeEntriesSummary } from '../models/time.entry.summary';
import { Injectable, Input } from '@angular/core';
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';

import { Observable } from 'rxjs';
Expand All @@ -19,11 +19,12 @@ export class EntryService {

static TIME_ENTRIES_DATE_TIME_FORMAT = 'yyyy-MM-ddTHH:mm:ssZZZZZ';
baseUrl = `${environment.timeTrackerApiUrl}/time-entries`;
@Input() showOptionInDevelopment: boolean;
urlInProduction = environment.production;

loadActiveEntry(): Observable<any> {
let path = '';
if (this.showOptionInDevelopment){

if (this.urlInProduction){
path = `${this.baseUrl}/running`;
}else{
path = `${this.baseUrl}/active/2`;
Expand Down