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 @@ -428,15 +428,21 @@ export class AngularTokenService implements CanActivate {
428428 return ( this . userType . value == null ) ? '' : this . userType . value . path + '/' ;
429429 }
430430
431+ private addTrailingSlashIfNeeded ( url : string ) : string {
432+ const lastChar = url [ url . length - 1 ] ;
433+
434+ return lastChar === '/' ? url : url + '/' ;
435+ }
436+
431437 private getApiPath ( ) : string {
432438 let constructedPath = '' ;
433439
434440 if ( this . options . apiBase != null ) {
435- constructedPath += this . options . apiBase + '/' ;
441+ constructedPath += this . addTrailingSlashIfNeeded ( this . options . apiBase ) ;
436442 }
437443
438444 if ( this . options . apiPath != null ) {
439- constructedPath += this . options . apiPath + '/' ;
445+ constructedPath += this . addTrailingSlashIfNeeded ( this . options . apiPath ) ;
440446 }
441447
442448 return constructedPath ;
You can’t perform that action at this time.
0 commit comments