Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(auth): fix isAuthenticatedOrRefresh to not refresh token with n… #708

Merged
merged 5 commits into from
Sep 12, 2018

Conversation

nnixaa
Copy link
Collaborator

@nnixaa nnixaa commented Sep 11, 2018

fix for #687

@codecov
Copy link

codecov bot commented Sep 11, 2018

Codecov Report

Merging #708 into master will increase coverage by 0.22%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #708      +/-   ##
==========================================
+ Coverage   72.96%   73.18%   +0.22%     
==========================================
  Files         179      176       -3     
  Lines        4867     4800      -67     
  Branches      368      367       -1     
==========================================
- Hits         3551     3513      -38     
+ Misses       1244     1215      -29     
  Partials       72       72
Impacted Files Coverage Δ
src/framework/auth/services/auth.service.ts 91.07% <100%> (ø) ⬆️
...work/theme/components/tooltip/tooltip.directive.ts
...amework/theme/components/tooltip/tooltip.module.ts
...work/theme/components/tooltip/tooltip.component.ts

@@ -51,7 +51,7 @@ export class NbAuthService {
return this.getToken()
.pipe(
switchMap(token => {
if (!token.isValid()) {
if (!token.isValid() && token.getValue()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (token.getValue() && !token.isValid())

makes more sense according to me (and maybe better performance ?)

@alain-charles
Copy link
Contributor

@nnixaa i agree with the code you wrote.
I only would test token.getValue() and if truthy !token.isValid() because i think is makes more sense.

if (token.getValue() && !token.isValid())

@nnixaa nnixaa merged commit b29418f into master Sep 12, 2018
@nnixaa nnixaa deleted the fix/is-auth-invalid-token branch September 12, 2018 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants