diff options
author | 杨宇千 <crupest@outlook.com> | 2019-03-11 21:30:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-11 21:30:22 +0800 |
commit | 4535d1fd30eb02b3fe60718235a0725e3b30049e (patch) | |
tree | d9d2ea66bb3b5586b3e0f9ac390dc3ac96096e2e /Timeline/ClientApp/src/app/user/internal-user-service/internal-user.service.ts | |
parent | 8caef17dd3e455de27f44d13751c27ee4dfe2e1e (diff) | |
parent | 87f7b00f9414b7633a080838a725a687461efd68 (diff) | |
download | timeline-4535d1fd30eb02b3fe60718235a0725e3b30049e.tar.gz timeline-4535d1fd30eb02b3fe60718235a0725e3b30049e.tar.bz2 timeline-4535d1fd30eb02b3fe60718235a0725e3b30049e.zip |
Merge pull request #12 from crupest/strict
Use strict check of typescript compiler.
Diffstat (limited to 'Timeline/ClientApp/src/app/user/internal-user-service/internal-user.service.ts')
-rw-r--r-- | Timeline/ClientApp/src/app/user/internal-user-service/internal-user.service.ts | 8 |
1 files changed, 5 insertions, 3 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 91a67e5b..4767bd16 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 @@ -5,6 +5,8 @@ import { Router } from '@angular/router'; import { Observable, of, throwError, BehaviorSubject } from 'rxjs'; import { map, catchError, retry } from 'rxjs/operators'; +import { nullIfUndefined } from '../../utilities/language-untilities'; + import { AlreadyLoginError, BadCredentialsError, BadNetworkError, UnknownError } from './errors'; import { createTokenUrl, validateTokenUrl, CreateTokenRequest, @@ -23,7 +25,7 @@ export type UserLoginState = 'nologin' | 'invalidlogin' | 'success'; }) export class InternalUserService { - private token: string; + private token: string | null = null; private userInfoSubject = new BehaviorSubject<UserInfo | null>(null); get currentUserInfo(): UserInfo | null { @@ -36,7 +38,7 @@ export class InternalUserService { constructor(private httpClient: HttpClient, private router: Router) { } - userRouteNavigate(commands: any[]) { + userRouteNavigate(commands: any[] | null) { this.router.navigate([{ outlets: { user: commands @@ -57,7 +59,7 @@ export class InternalUserService { }), map(result => { if (result.isValid) { - this.userInfoSubject.next(result.userInfo); + this.userInfoSubject.next(nullIfUndefined(result.userInfo)); return <UserLoginState>'success'; } else { this.token = null; |