diff --git a/src/packages/notification/component/notification/notification.component.ts b/src/packages/notification/component/notification/notification.component.ts index 218e833..ca0b9c4 100644 --- a/src/packages/notification/component/notification/notification.component.ts +++ b/src/packages/notification/component/notification/notification.component.ts @@ -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; @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); + // } + // ); } diff --git a/src/packages/notification/service/notification.service.ts b/src/packages/notification/service/notification.service.ts index 8d48e07..5dd4523 100644 --- a/src/packages/notification/service/notification.service.ts +++ b/src/packages/notification/service/notification.service.ts @@ -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 { + public readAllByMember(member: Member, pageParams: PageParams): Observable { - return this.rpcClient.call('NotificationService.readAllByMember', member); + return this.rpcClient.call('NotificationService.readAllByMember', member, pageParams); } diff --git a/src/packages/notification/store/notification/notification.action.ts b/src/packages/notification/store/notification/notification.action.ts index 5bfbd1f..548b0ba 100644 --- a/src/packages/notification/store/notification/notification.action.ts +++ b/src/packages/notification/store/notification/notification.action.ts @@ -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 { diff --git a/src/packages/notification/store/notification/notification.effect.ts b/src/packages/notification/store/notification/notification.effect.ts index ac0c9f8..bbe0bd4 100644 --- a/src/packages/notification/store/notification/notification.effect.ts +++ b/src/packages/notification/store/notification/notification.effect.ts @@ -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); })