@@ -520,28 +520,48 @@ const ROUTES = {
520
520
} ,
521
521
MONEY_REQUEST_STEP_AMOUNT : {
522
522
route : ':action/:iouType/amount/:transactionID/:reportID/:pageIndex?' ,
523
- getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string , reportID : string , pageIndex : string , backTo = '' ) =>
524
- getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /amount/${ transactionID } /${ reportID } /${ pageIndex } ` , backTo ) ,
523
+ getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string | undefined , reportID : string | undefined , pageIndex : string , backTo = '' ) => {
524
+ if ( ! transactionID || ! reportID ) {
525
+ Log . warn ( 'Invalid transactionID or reportID is used to build the MONEY_REQUEST_STEP_AMOUNT route' ) ;
526
+ }
527
+ return getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /amount/${ transactionID } /${ reportID } /${ pageIndex } ` , backTo ) ;
528
+ } ,
525
529
} ,
526
530
MONEY_REQUEST_STEP_TAX_RATE : {
527
531
route : ':action/:iouType/taxRate/:transactionID/:reportID?' ,
528
- getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string , reportID : string , backTo = '' ) =>
529
- getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /taxRate/${ transactionID } /${ reportID } ` , backTo ) ,
532
+ getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string | undefined , reportID : string | undefined , backTo = '' ) => {
533
+ if ( ! transactionID || ! reportID ) {
534
+ Log . warn ( 'Invalid transactionID or reportID is used to build the MONEY_REQUEST_STEP_TAX_RATE route' ) ;
535
+ }
536
+ return getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /taxRate/${ transactionID } /${ reportID } ` , backTo ) ;
537
+ } ,
530
538
} ,
531
539
MONEY_REQUEST_STEP_TAX_AMOUNT : {
532
540
route : ':action/:iouType/taxAmount/:transactionID/:reportID?' ,
533
- getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string , reportID : string , backTo = '' ) =>
534
- getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /taxAmount/${ transactionID } /${ reportID } ` , backTo ) ,
541
+ getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string | undefined , reportID : string | undefined , backTo = '' ) => {
542
+ if ( ! transactionID || ! reportID ) {
543
+ Log . warn ( 'Invalid transactionID or reportID is used to build the MONEY_REQUEST_STEP_TAX_AMOUNT route' ) ;
544
+ }
545
+ return getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /taxAmount/${ transactionID } /${ reportID } ` , backTo ) ;
546
+ } ,
535
547
} ,
536
548
MONEY_REQUEST_STEP_CATEGORY : {
537
549
route : ':action/:iouType/category/:transactionID/:reportID/:reportActionID?' ,
538
- getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string , reportID : string | undefined , backTo = '' , reportActionID ?: string ) =>
539
- getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /category/${ transactionID } /${ reportID } ${ reportActionID ? `/${ reportActionID } ` : '' } ` , backTo ) ,
550
+ getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string | undefined , reportID : string | undefined , backTo = '' , reportActionID ?: string ) => {
551
+ if ( ! transactionID || ! reportID ) {
552
+ Log . warn ( 'Invalid transactionID or reportID is used to build the MONEY_REQUEST_STEP_CATEGORY route' ) ;
553
+ }
554
+ return getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /category/${ transactionID } /${ reportID } ${ reportActionID ? `/${ reportActionID } ` : '' } ` , backTo ) ;
555
+ } ,
540
556
} ,
541
557
MONEY_REQUEST_ATTENDEE : {
542
558
route : ':action/:iouType/attendees/:transactionID/:reportID' ,
543
- getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string , reportID : string , backTo = '' ) =>
544
- getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /attendees/${ transactionID } /${ reportID } ` , backTo ) ,
559
+ getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string | undefined , reportID : string | undefined , backTo = '' ) => {
560
+ if ( ! transactionID || ! reportID ) {
561
+ Log . warn ( 'Invalid transactionID or reportID is used to build the MONEY_REQUEST_ATTENDEE route' ) ;
562
+ }
563
+ return getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /attendees/${ transactionID } /${ reportID } ` , backTo ) ;
564
+ } ,
545
565
} ,
546
566
MONEY_REQUEST_UPGRADE : {
547
567
route : ':action/:iouType/upgrade/:transactionID/:reportID' ,
@@ -676,28 +696,48 @@ const ROUTES = {
676
696
} ,
677
697
MONEY_REQUEST_STEP_DATE : {
678
698
route : ':action/:iouType/date/:transactionID/:reportID/:reportActionID?' ,
679
- getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string , reportID : string , backTo = '' , reportActionID ?: string ) =>
680
- getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /date/${ transactionID } /${ reportID } ${ reportActionID ? `/${ reportActionID } ` : '' } ` , backTo ) ,
699
+ getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string | undefined , reportID : string | undefined , backTo = '' , reportActionID ?: string ) => {
700
+ if ( ! transactionID || ! reportID ) {
701
+ Log . warn ( 'Invalid transactionID or reportID is used to build the MONEY_REQUEST_STEP_DATE route' ) ;
702
+ }
703
+ return getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /date/${ transactionID } /${ reportID } ${ reportActionID ? `/${ reportActionID } ` : '' } ` , backTo ) ;
704
+ } ,
681
705
} ,
682
706
MONEY_REQUEST_STEP_DESCRIPTION : {
683
707
route : ':action/:iouType/description/:transactionID/:reportID/:reportActionID?' ,
684
- getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string , reportID : string , backTo = '' , reportActionID ?: string ) =>
685
- getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /description/${ transactionID } /${ reportID } ${ reportActionID ? `/${ reportActionID } ` : '' } ` , backTo ) ,
708
+ getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string | undefined , reportID : string | undefined , backTo = '' , reportActionID ?: string ) => {
709
+ if ( ! transactionID || ! reportID ) {
710
+ Log . warn ( 'Invalid transactionID or reportID is used to build the MONEY_REQUEST_STEP_DESCRIPTION route' ) ;
711
+ }
712
+ return getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /description/${ transactionID } /${ reportID } ${ reportActionID ? `/${ reportActionID } ` : '' } ` , backTo ) ;
713
+ } ,
686
714
} ,
687
715
MONEY_REQUEST_STEP_DISTANCE : {
688
716
route : ':action/:iouType/distance/:transactionID/:reportID' ,
689
- getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string , reportID : string , backTo = '' ) =>
690
- getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /distance/${ transactionID } /${ reportID } ` , backTo ) ,
717
+ getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string | undefined , reportID : string | undefined , backTo = '' ) => {
718
+ if ( ! transactionID || ! reportID ) {
719
+ Log . warn ( 'Invalid transactionID or reportID is used to build the MONEY_REQUEST_STEP_DISTANCE route' ) ;
720
+ }
721
+ return getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /distance/${ transactionID } /${ reportID } ` , backTo ) ;
722
+ } ,
691
723
} ,
692
724
MONEY_REQUEST_STEP_DISTANCE_RATE : {
693
725
route : ':action/:iouType/distanceRate/:transactionID/:reportID' ,
694
- getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string , reportID : string , backTo = '' ) =>
695
- getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /distanceRate/${ transactionID } /${ reportID } ` , backTo ) ,
726
+ getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string | undefined , reportID : string | undefined , backTo = '' ) => {
727
+ if ( ! transactionID || ! reportID ) {
728
+ Log . warn ( 'Invalid transactionID or reportID is used to build the MONEY_REQUEST_STEP_DISTANCE_RATE route' ) ;
729
+ }
730
+ return getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /distanceRate/${ transactionID } /${ reportID } ` , backTo ) ;
731
+ } ,
696
732
} ,
697
733
MONEY_REQUEST_STEP_MERCHANT : {
698
734
route : ':action/:iouType/merchant/:transactionID/:reportID' ,
699
- getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string , reportID : string , backTo = '' ) =>
700
- getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /merchant/${ transactionID } /${ reportID } ` , backTo ) ,
735
+ getRoute : ( action : IOUAction , iouType : IOUType , transactionID : string | undefined , reportID : string | undefined , backTo = '' ) => {
736
+ if ( ! transactionID || ! reportID ) {
737
+ Log . warn ( 'Invalid transactionID or reportID is used to build the MONEY_REQUEST_STEP_MERCHANT route' ) ;
738
+ }
739
+ return getUrlWithBackToParam ( `${ action as string } /${ iouType as string } /merchant/${ transactionID } /${ reportID } ` , backTo ) ;
740
+ } ,
701
741
} ,
702
742
MONEY_REQUEST_STEP_PARTICIPANTS : {
703
743
route : ':action/:iouType/participants/:transactionID/:reportID' ,
@@ -1653,12 +1693,21 @@ const ROUTES = {
1653
1693
TRACK_TRAINING_MODAL : 'track-training' ,
1654
1694
TRAVEL_TRIP_SUMMARY : {
1655
1695
route : 'r/:reportID/trip/:transactionID' ,
1656
- getRoute : ( reportID : string , transactionID : string , backTo ?: string ) => getUrlWithBackToParam ( `r/${ reportID } /trip/${ transactionID } ` , backTo ) ,
1696
+ getRoute : ( reportID : string | undefined , transactionID : string | undefined , backTo ?: string ) => {
1697
+ if ( ! reportID || ! transactionID ) {
1698
+ Log . warn ( 'Invalid reportID or transactionID is used to build the TRAVEL_TRIP_SUMMARY route' ) ;
1699
+ }
1700
+ return getUrlWithBackToParam ( `r/${ reportID } /trip/${ transactionID } ` , backTo ) ;
1701
+ } ,
1657
1702
} ,
1658
1703
TRAVEL_TRIP_DETAILS : {
1659
1704
route : 'r/:reportID/trip/:transactionID/:reservationIndex' ,
1660
- getRoute : ( reportID : string , transactionID : string , reservationIndex : number , backTo ?: string ) =>
1661
- getUrlWithBackToParam ( `r/${ reportID } /trip/${ transactionID } /${ reservationIndex } ` , backTo ) ,
1705
+ getRoute : ( reportID : string | undefined , transactionID : string | undefined , reservationIndex : number , backTo ?: string ) => {
1706
+ if ( ! reportID || ! transactionID ) {
1707
+ Log . warn ( 'Invalid reportID or transactionID is used to build the TRAVEL_TRIP_DETAILS route' ) ;
1708
+ }
1709
+ return getUrlWithBackToParam ( `r/${ reportID } /trip/${ transactionID } /${ reservationIndex } ` , backTo ) ;
1710
+ } ,
1662
1711
} ,
1663
1712
TRAVEL_DOMAIN_SELECTOR : 'travel/domain-selector' ,
1664
1713
TRAVEL_DOMAIN_PERMISSION_INFO : {
0 commit comments