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 { ReadAllByMemberSelector } from '../../store';
|
||||||
import { AuthSelector } from 'packages/member/store';
|
import { AuthSelector } from 'packages/member/store';
|
||||||
import { Member } from '../../../member/model';
|
import { Member } from '../../../member/model';
|
||||||
|
import { PageParams } from 'app/commons/model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'of-notification',
|
selector: 'of-notification',
|
||||||
|
@ -30,9 +31,6 @@ export class NotificationComponent implements OnInit, AfterContentInit {
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.notification$.subscribe(
|
this.notification$.subscribe(
|
||||||
(notifications: Notification[]) => {
|
(notifications: Notification[]) => {
|
||||||
console.log('#########');
|
|
||||||
console.log(notifications);
|
|
||||||
console.log('#########');
|
|
||||||
this.dataSource = new MatTableDataSource(notifications);
|
this.dataSource = new MatTableDataSource(notifications);
|
||||||
this.dataSource.sort = this.sort;
|
this.dataSource.sort = this.sort;
|
||||||
},
|
},
|
||||||
|
@ -43,15 +41,18 @@ export class NotificationComponent implements OnInit, AfterContentInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterContentInit() {
|
ngAfterContentInit() {
|
||||||
this.store.select(AuthSelector.select('member')).subscribe(
|
// this.store.select(AuthSelector.select('member')).subscribe(
|
||||||
(member: Member) => {
|
// (member: Member) => {
|
||||||
console.log(member);
|
// const pageParams: PageParams = {
|
||||||
this.store.dispatch(new NotificationStore.ReadAllByMember(member));
|
// pageNo: '1',
|
||||||
},
|
// countPerPage: '10',
|
||||||
(error) => {
|
// };
|
||||||
console.log(error);
|
// 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 { Notification } from '../model';
|
||||||
import { Member } from '../../member/model';
|
import { Member } from '../../member/model';
|
||||||
|
import { PageParams } from 'app/commons/model';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class NotificationService {
|
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 { Notification } from '../../model';
|
||||||
import { Member } from '../../../member/model';
|
import { Member } from '../../../member/model';
|
||||||
|
import { PageParams } from 'app/commons/model';
|
||||||
|
|
||||||
export enum ActionType {
|
export enum ActionType {
|
||||||
ReadAllByMember = '[Notification.notification] ReadAllByMember',
|
ReadAllByMember = '[Notification.notification] ReadAllByMember',
|
||||||
|
@ -14,7 +15,7 @@ export enum ActionType {
|
||||||
export class ReadAllByMember implements Action {
|
export class ReadAllByMember implements Action {
|
||||||
readonly type = ActionType.ReadAllByMember;
|
readonly type = ActionType.ReadAllByMember;
|
||||||
|
|
||||||
constructor(public payload: Member) {}
|
constructor(public payload: { member: Member, pageParams: PageParams }) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ReadAllByMemberSuccess implements Action {
|
export class ReadAllByMemberSuccess implements Action {
|
||||||
|
|
|
@ -46,7 +46,7 @@ export class Effects {
|
||||||
// );
|
// );
|
||||||
.ofType(ActionType.ReadAllByMember)
|
.ofType(ActionType.ReadAllByMember)
|
||||||
.map((action: ReadAllByMember) => action.payload)
|
.map((action: ReadAllByMember) => action.payload)
|
||||||
.switchMap(payload => this.notificationService.readAllByMember(payload))
|
.switchMap(payload => this.notificationService.readAllByMember(payload.member, payload.pageParams))
|
||||||
.map(notifications => {
|
.map(notifications => {
|
||||||
return new ReadAllByMemberSuccess(notifications);
|
return new ReadAllByMemberSuccess(notifications);
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user