Skip to content

Commit

Permalink
fix: timeout in auth guard only on first routing
Browse files Browse the repository at this point in the history
  • Loading branch information
dhhyi committed Feb 28, 2020
1 parent 7314bf0 commit d7a310c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/core/guards/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ export class AuthGuard implements CanActivate, CanActivateChild {
whenTruthy(),
take(1)
),
// send to login after timeout
timer(4000).pipe(mapTo(this.router.createUrlTree(['/login'], { queryParams: { returnUrl: url } })))
// send to login after timeout on first routing only
timer(this.router.navigated ? 0 : 4000).pipe(
mapTo(this.router.createUrlTree(['/login'], { queryParams: { returnUrl: url } }))
)
);
}
}

0 comments on commit d7a310c

Please sign in to comment.