member_webapp/@overflow/notification/store/notification/notification.action.ts
crusader d773379d8f ing
2018-05-25 12:37:18 +09:00

62 lines
1.9 KiB
TypeScript

import { Action } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { Member } from '@overflow/commons-typescript/model/member';
import { PageParams } from '@overflow/commons-typescript/model/commons/PageParams';
import { Page } from '@overflow/commons-typescript/model/commons/Page';
import { Notification } from '@overflow/commons-typescript/model/notification';
export enum ActionType {
ReadAllByMember = '[Notification.list] ReadAllByMember',
ReadAllByMemberSuccess = '[Notification.list] ReadAllByMemberSuccess',
ReadAllByMemberFailure = '[Notification.list] ReadAllByMemberFailure',
MarkAllAsRead = '[Notification.mark] MarkAllAsRead',
MarkAllAsReadSuccess = '[Notification.mark] MarkAllAsReadSuccess',
MarkAllAsReadFailure = '[Notification.mark] MarkAllAsReadFailure',
}
export class ReadAllByMember implements Action {
readonly type = ActionType.ReadAllByMember;
constructor(public payload: { member: Member, pageParams: PageParams }) {}
}
export class ReadAllByMemberSuccess implements Action {
readonly type = ActionType.ReadAllByMemberSuccess;
constructor(public payload: Page<Notification>) {}
}
export class ReadAllByMemberFailure implements Action {
readonly type = ActionType.ReadAllByMemberFailure;
constructor(public payload: RPCClientError) {}
}
export class MarkAllAsRead implements Action {
readonly type = ActionType.MarkAllAsRead;
constructor(public payload: { member: Member, pageParams: PageParams }) {}
}
export class MarkAllAsReadSuccess implements Action {
readonly type = ActionType.MarkAllAsReadSuccess;
constructor(public payload: Page<Notification>) {}
}
export class MarkAllAsReadFailure implements Action {
readonly type = ActionType.MarkAllAsReadFailure;
constructor(public payload: RPCClientError) {}
}
export type Actions =
| ReadAllByMember
| ReadAllByMemberSuccess
| ReadAllByMemberFailure
| MarkAllAsRead
| MarkAllAsReadSuccess
| MarkAllAsReadFailure
;