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 {
428
428
return ( this . userType . value == null ) ? '' : this . userType . value . path + '/' ;
429
429
}
430
430
431
+ private addTrailingSlashIfNeeded ( url : string ) : string {
432
+ const lastChar = url [ url . length - 1 ] ;
433
+
434
+ return lastChar === '/' ? url : url + '/' ;
435
+ }
436
+
431
437
private getApiPath ( ) : string {
432
438
let constructedPath = '' ;
433
439
434
440
if ( this . options . apiBase != null ) {
435
- constructedPath += this . options . apiBase + '/' ;
441
+ constructedPath += this . addTrailingSlashIfNeeded ( this . options . apiBase ) ;
436
442
}
437
443
438
444
if ( this . options . apiPath != null ) {
439
- constructedPath += this . options . apiPath + '/' ;
445
+ constructedPath += this . addTrailingSlashIfNeeded ( this . options . apiPath ) ;
440
446
}
441
447
442
448
return constructedPath ;
You can’t perform that action at this time.
0 commit comments