Skip to content

Commit

Permalink
fix(package): do not break the route of authGuardLoggedInURL is not p…
Browse files Browse the repository at this point in the history
…rovided #309
  • Loading branch information
AnthonyNahas committed Aug 8, 2019
1 parent e2ed829 commit c3296bd
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/module/guards/logged-in.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ import {CanActivate, Router} from '@angular/router'
import {map} from 'rxjs/operators'
import {Observable} from 'rxjs'

import {
AuthProcessService,
NgxAuthFirebaseUIConfig,
NgxAuthFirebaseUIConfigToken,
} from '../ngx-auth-firebase-u-i.module'
import {AuthProcessService, NgxAuthFirebaseUIConfig, NgxAuthFirebaseUIConfigToken} from '../ngx-auth-firebase-u-i.module'

@Injectable({
providedIn: 'root',
Expand All @@ -25,13 +21,13 @@ export class LoggedInGuard implements CanActivate {
return this.auth.afa.user.pipe(
map(res => {
if (res) {
if (this.config.authGuardLoggedInURL) {
this.router.navigate([`/${this.config.authGuardLoggedInURL}`]);
if (this.config.authGuardLoggedInURL && this.config.authGuardLoggedInURL !== '/') {
this.router.navigate([`${this.config.authGuardLoggedInURL}`]);
}
return true
}
if (this.config.authGuardFallbackURL) {
this.router.navigate([`/${this.config.authGuardFallbackURL}`]);
if (this.config.authGuardFallbackURL && this.config.authGuardFallbackURL !== '/') {
this.router.navigate([`${this.config.authGuardFallbackURL}`]);
}
return false
}),
Expand Down

0 comments on commit c3296bd

Please sign in to comment.