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 | 1834e12467b06d4a5f8a3610e93ed201502d872f (patch) | |
tree | 993f2dce68e9a4a4af2ecbbca519b9d5e48abc08 | |
parent | eeba297d0764a7d9862e1bd84dc85f23528159c7 (diff) | |
download | timeline-1834e12467b06d4a5f8a3610e93ed201502d872f.tar.gz timeline-1834e12467b06d4a5f8a3610e93ed201502d872f.tar.bz2 timeline-1834e12467b06d4a5f8a3610e93ed201502d872f.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); }); } } |