test
This commit is contained in:
parent
1fc94ebd7d
commit
a506bdc587
|
@ -8,6 +8,7 @@ import * as NotificationStore from '../../store/notification';
|
|||
import { ReadAllByMemberSelector } from '../../store';
|
||||
import { AuthSelector } from 'packages/member/store';
|
||||
import { Member } from '../../../member/model';
|
||||
import { PageParams } from 'app/commons/model';
|
||||
|
||||
@Component({
|
||||
selector: 'of-notification',
|
||||
|
@ -18,7 +19,7 @@ export class NotificationComponent implements OnInit, AfterContentInit {
|
|||
|
||||
notification$ = this.store.pipe(select(ReadAllByMemberSelector.select('notifications')));
|
||||
|
||||
displayedColumns = ['id', 'title', 'message', 'member' ];
|
||||
displayedColumns = ['id', 'title', 'message', 'member'];
|
||||
dataSource: MatTableDataSource<Notification>;
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
|
||||
|
@ -30,9 +31,6 @@ export class NotificationComponent implements OnInit, AfterContentInit {
|
|||
ngOnInit() {
|
||||
this.notification$.subscribe(
|
||||
(notifications: Notification[]) => {
|
||||
console.log('#########');
|
||||
console.log(notifications);
|
||||
console.log('#########');
|
||||
this.dataSource = new MatTableDataSource(notifications);
|
||||
this.dataSource.sort = this.sort;
|
||||
},
|
||||
|
@ -43,15 +41,18 @@ export class NotificationComponent implements OnInit, AfterContentInit {
|
|||
}
|
||||
|
||||
ngAfterContentInit() {
|
||||
this.store.select(AuthSelector.select('member')).subscribe(
|
||||
(member: Member) => {
|
||||
console.log(member);
|
||||
this.store.dispatch(new NotificationStore.ReadAllByMember(member));
|
||||
},
|
||||
(error) => {
|
||||
console.log(error);
|
||||
}
|
||||
);
|
||||
// this.store.select(AuthSelector.select('member')).subscribe(
|
||||
// (member: Member) => {
|
||||
// const pageParams: PageParams = {
|
||||
// pageNo: '1',
|
||||
// countPerPage: '10',
|
||||
// };
|
||||
// this.store.dispatch(new NotificationStore.ReadAllByMember({member, pageParams}));
|
||||
// },
|
||||
// (error) => {
|
||||
// console.log(error);
|
||||
// }
|
||||
// );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import { RPCClient } from 'packages/core/rpc/client/RPCClient';
|
|||
|
||||
import { Notification } from '../model';
|
||||
import { Member } from '../../member/model';
|
||||
import { PageParams } from 'app/commons/model';
|
||||
|
||||
@Injectable()
|
||||
export class NotificationService {
|
||||
|
@ -17,9 +18,9 @@ export class NotificationService {
|
|||
|
||||
}
|
||||
|
||||
public readAllByMember(member: Member): Observable<Notification[]> {
|
||||
public readAllByMember(member: Member, pageParams: PageParams): Observable<Notification[]> {
|
||||
|
||||
return this.rpcClient.call('NotificationService.readAllByMember', member);
|
||||
return this.rpcClient.call('NotificationService.readAllByMember', member, pageParams);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import { RPCError } from 'packages/core/rpc/error';
|
|||
|
||||
import { Notification } from '../../model';
|
||||
import { Member } from '../../../member/model';
|
||||
import { PageParams } from 'app/commons/model';
|
||||
|
||||
export enum ActionType {
|
||||
ReadAllByMember = '[Notification.notification] ReadAllByMember',
|
||||
|
@ -14,7 +15,7 @@ export enum ActionType {
|
|||
export class ReadAllByMember implements Action {
|
||||
readonly type = ActionType.ReadAllByMember;
|
||||
|
||||
constructor(public payload: Member) {}
|
||||
constructor(public payload: { member: Member, pageParams: PageParams }) {}
|
||||
}
|
||||
|
||||
export class ReadAllByMemberSuccess implements Action {
|
||||
|
|
|
@ -46,7 +46,7 @@ export class Effects {
|
|||
// );
|
||||
.ofType(ActionType.ReadAllByMember)
|
||||
.map((action: ReadAllByMember) => action.payload)
|
||||
.switchMap(payload => this.notificationService.readAllByMember(payload))
|
||||
.switchMap(payload => this.notificationService.readAllByMember(payload.member, payload.pageParams))
|
||||
.map(notifications => {
|
||||
return new ReadAllByMemberSuccess(notifications);
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user