File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
projects/angular-token/src/lib Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -431,15 +431,21 @@ export class AngularTokenService implements CanActivate {
431431 return ( this . userType . value == null ) ? '' : this . userType . value . path + '/' ;
432432 }
433433
434+ private addTrailingSlashIfNeeded ( url : string ) : string {
435+ const lastChar = url [ url . length - 1 ] ;
436+
437+ return lastChar === '/' ? url : url + '/' ;
438+ }
439+
434440 private getApiPath ( ) : string {
435441 let constructedPath = '' ;
436442
437443 if ( this . options . apiBase != null ) {
438- constructedPath += this . options . apiBase + '/' ;
444+ constructedPath += this . addTrailingSlashIfNeeded ( this . options . apiBase ) ;
439445 }
440446
441447 if ( this . options . apiPath != null ) {
442- constructedPath += this . options . apiPath + '/' ;
448+ constructedPath += this . addTrailingSlashIfNeeded ( this . options . apiPath ) ;
443449 }
444450
445451 return constructedPath ;
You can’t perform that action at this time.
0 commit comments