diff options
author | crupest <crupest@outlook.com> | 2019-03-18 21:57:02 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-03-18 21:57:02 +0800 |
commit | bfff5579382ba5671a531cbab5ff14b7207dd15e (patch) | |
tree | c17202457c4028f2542b07bc6bc72d915e4ec3d3 | |
parent | b47d61c59c399f45d7fa59f600c58e9089cb1dab (diff) | |
download | timeline-bfff5579382ba5671a531cbab5ff14b7207dd15e.tar.gz timeline-bfff5579382ba5671a531cbab5ff14b7207dd15e.tar.bz2 timeline-bfff5579382ba5671a531cbab5ff14b7207dd15e.zip |
Fix a bug. Set userInfo to null when nologin.
-rw-r--r-- | Timeline/ClientApp/src/app/user/internal-user-service/internal-user.service.ts | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Timeline/ClientApp/src/app/user/internal-user-service/internal-user.service.ts b/Timeline/ClientApp/src/app/user/internal-user-service/internal-user.service.ts index d82e9613..3f6147af 100644 --- a/Timeline/ClientApp/src/app/user/internal-user-service/internal-user.service.ts +++ b/Timeline/ClientApp/src/app/user/internal-user-service/internal-user.service.ts @@ -52,11 +52,13 @@ export class InternalUserService { const savedToken = this.window.localStorage.getItem(TOKEN_STORAGE_KEY); if (savedToken === null) { this.openSnackBar(snackBar, 'noLogin'); + this.userInfoSubject.next(null); } else { this.validateToken(savedToken).subscribe(result => { if (result === null) { this.window.localStorage.removeItem(TOKEN_STORAGE_KEY); this.openSnackBar(snackBar, 'invalidLogin'); + this.userInfoSubject.next(null); } else { this.token = savedToken; this.userInfoSubject.next(result); @@ -64,6 +66,7 @@ export class InternalUserService { } }, _ => { this.openSnackBar(snackBar, 'checkFail'); + this.userInfoSubject.next(null); }); } } |