@@ -11,26 +11,29 @@ export class ResultSelectionService {
1111 }
1212
1313 fetchResultSelectionData < T > ( resultSelectionCommand : ResultSelectionCommand , url : URL ) : Observable < T > {
14- const params = this . createParamsFromResultSelectionCommand ( resultSelectionCommand ) ;
15- return this . http . get < T > ( url , { params : params } ) . pipe (
16- this . handleError ( )
17- )
14+ if ( resultSelectionCommand . from && resultSelectionCommand . to ) {
15+ const params = this . createParamsFromResultSelectionCommand ( resultSelectionCommand ) ;
16+ return this . http . get < T > ( url , { params : params } ) . pipe (
17+ this . handleError ( )
18+ )
19+ }
20+ return new Observable < T > ( ) ;
1821 }
1922
2023 private createParamsFromResultSelectionCommand ( resultSelectionCommand : ResultSelectionCommand ) {
21- let params = new HttpParams ( ) ;
24+ let params = new HttpParams ( )
25+ . set ( 'from' , resultSelectionCommand . from . toISOString ( ) )
26+ . set ( 'to' , resultSelectionCommand . to . toISOString ( ) )
27+ . set ( 'caller' , Caller [ resultSelectionCommand . caller ] ) ;
2228
2329 Object . keys ( resultSelectionCommand ) . forEach ( key => {
30+ if ( key === 'from' || key === 'to' || key === 'caller' ) {
31+ return ;
32+ }
2433 if ( resultSelectionCommand [ key ] . length > 0 ) {
25- if ( key === 'from' || key === 'to' ) {
26- params . append ( key , resultSelectionCommand [ key ] . toISOString ( ) )
27- } else if ( key === 'caller' ) {
28- params . append ( key , Caller [ resultSelectionCommand [ key ] ] )
29- } else {
30- resultSelectionCommand [ key ] . forEach ( id => {
31- params = params . append ( key , id . toString ( ) )
32- } ) ;
33- }
34+ resultSelectionCommand [ key ] . forEach ( id => {
35+ params = params . append ( key , id . toString ( ) )
36+ } ) ;
3437 }
3538 } ) ;
3639
0 commit comments