aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2019-03-18 21:57:02 +0800
committercrupest <crupest@outlook.com>2019-03-18 21:57:02 +0800
commitbfff5579382ba5671a531cbab5ff14b7207dd15e (patch)
treec17202457c4028f2542b07bc6bc72d915e4ec3d3
parentb47d61c59c399f45d7fa59f600c58e9089cb1dab (diff)
downloadtimeline-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.ts3
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);
});
}
}