next-ucap-messenger/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/messages.component.ts

43 lines
1.3 KiB
TypeScript
Raw Normal View History

import { Component, OnInit } from '@angular/core';
import { ucapAnimations } from '@ucap-webmessenger/ui';
2019-10-08 04:31:33 +00:00
import { Store, select } from '@ngrx/store';
import { NGXLogger } from 'ngx-logger';
import { Observable } from 'rxjs';
import { Info } from '@ucap-webmessenger/protocol-event';
import * as AppStore from '@app/store';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
@Component({
2019-09-26 02:11:22 +00:00
selector: 'app-layout-messenger-messages',
templateUrl: './messages.component.html',
styleUrls: ['./messages.component.scss'],
animations: ucapAnimations
})
export class MessagesComponent implements OnInit {
2019-10-08 04:31:33 +00:00
loginRes$: Observable<LoginResponse>;
eventList$: Observable<Info[]>;
constructor(
private store: Store<any>,
private sessionStorageService: SessionStorageService,
private logger: NGXLogger
) {}
ngOnInit() {
const loginInfo = this.sessionStorageService.get<LoginInfo>(KEY_LOGIN_INFO);
this.loginRes$ = this.store.pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes)
);
2019-10-08 04:31:33 +00:00
this.eventList$ = this.store.pipe(
select(AppStore.MessengerSelector.EventSelector.infoList)
);
}
selectContact() {}
}