aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/src/app/user/user.service.ts
blob: e876706cb3304f556b05165979658be7eff10212 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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'
    });
  }
}