diff options
author | crupest <crupest@outlook.com> | 2019-03-09 21:36:55 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-03-09 21:36:55 +0800 |
commit | 14a799cc17f16ab93ee652bd9a2973c60cb3697c (patch) | |
tree | 9c34cb2354dd7fb90994c3659ae592f6b616c898 /Timeline/ClientApp/src/app/user/user.service.ts | |
parent | f65ac5d592e4e449dd513ad01cfd2b980324f240 (diff) | |
download | timeline-14a799cc17f16ab93ee652bd9a2973c60cb3697c.tar.gz timeline-14a799cc17f16ab93ee652bd9a2973c60cb3697c.tar.bz2 timeline-14a799cc17f16ab93ee652bd9a2973c60cb3697c.zip |
Seperate internal and public user service.
Diffstat (limited to 'Timeline/ClientApp/src/app/user/user.service.ts')
-rw-r--r-- | Timeline/ClientApp/src/app/user/user.service.ts | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Timeline/ClientApp/src/app/user/user.service.ts b/Timeline/ClientApp/src/app/user/user.service.ts new file mode 100644 index 00000000..e876706c --- /dev/null +++ b/Timeline/ClientApp/src/app/user/user.service.ts @@ -0,0 +1,33 @@ +import { Injectable } from '@angular/core'; +import { MatDialog } from '@angular/material'; + +import { Observable } from 'rxjs'; + +import { UserInfo } from './entities'; +import { InternalUserService } from './internal-user-service/internal-user.service'; +import { UserDialogComponent } from './user-dialog/user-dialog.component'; + + +/** + * This service provides public api of user module. + */ +@Injectable({ + providedIn: 'root' +}) +export class UserService { + constructor(private dialog: MatDialog, private internalService: InternalUserService) { } + + get currentUserInfo(): UserInfo | null { + return this.internalService.currentUserInfo; + } + + get userInfo$(): Observable<UserInfo | null> { + return this.internalService.userInfo$; + } + + openUserDialog() { + this.dialog.open(UserDialogComponent, { + width: '300px' + }); + } +} |