member_webapp/@overflow/member/store/entity/member-totp/member-totp.action.ts

88 lines
2.5 KiB
TypeScript
Raw Normal View History

2018-04-06 11:02:18 +00:00
import { Action } from '@ngrx/store';
2018-05-29 09:32:22 +00:00
import { RPCClientError } from '@loafer/ng-rpc';
2018-04-06 11:02:18 +00:00
2018-05-02 08:09:39 +00:00
import { Member } from '@overflow/commons-typescript/model/member';
2018-04-06 11:02:18 +00:00
export enum ActionType {
2018-05-28 07:51:33 +00:00
CreateTotp = '[member.member-totp] CreateTotp',
CreateTotpSuccess = '[member.member-totp] CreateTotpSuccess',
CreateTotpFailure = '[member.member-totp] CreateTotpFailure',
2018-04-06 11:02:18 +00:00
2018-05-28 07:51:33 +00:00
Regist = '[member.member-totp] Regist',
RegistSuccess = '[member.member-totp] RegistSuccess',
RegistFailure = '[member.member-totp] RegistFailure',
2018-04-06 11:02:18 +00:00
2018-05-28 07:51:33 +00:00
CheckCodeForMember = '[member.member-totp] CheckCodeForMember',
CheckCodeForMemberSuccess = '[member.member-totp] CheckCodeForMemberSuccess',
CheckCodeForMemberFailure = '[member.member-totp] CheckCodeForMemberFailure',
2018-04-06 11:02:18 +00:00
}
export class CreateTotp implements Action {
readonly type = ActionType.CreateTotp;
2018-04-19 13:05:39 +00:00
constructor(public payload: Member) {}
2018-04-06 11:02:18 +00:00
}
export class CreateTotpSuccess implements Action {
readonly type = ActionType.CreateTotpSuccess;
constructor(public payload: {key: string, uri: string}) {}
}
export class CreateTotpFailure implements Action {
readonly type = ActionType.CreateTotpFailure;
2018-05-29 09:32:22 +00:00
constructor(public payload: RPCClientError) {}
2018-04-06 11:02:18 +00:00
}
// ----------------------------------------------------------------------------------------
export class Regist implements Action {
readonly type = ActionType.Regist;
constructor(public payload: {member: Member, secretCode: string, code: string}) {}
}
export class RegistSuccess implements Action {
readonly type = ActionType.RegistSuccess;
}
export class RegistFailure implements Action {
readonly type = ActionType.RegistFailure;
2018-05-29 09:32:22 +00:00
constructor(public payload: RPCClientError) {}
2018-04-06 11:02:18 +00:00
}
// ----------------------------------------------------------------------------------------
export class CheckCodeForMember implements Action {
readonly type = ActionType.CheckCodeForMember;
constructor(public payload: {member: Member, code: string}) {}
}
export class CheckCodeForMemberSuccess implements Action {
readonly type = ActionType.CheckCodeForMemberSuccess;
2018-05-28 12:37:47 +00:00
constructor(public payload: boolean) {}
2018-04-06 11:02:18 +00:00
}
export class CheckCodeForMemberFailure implements Action {
readonly type = ActionType.CheckCodeForMemberFailure;
2018-05-29 09:32:22 +00:00
constructor(public payload: RPCClientError) {}
2018-04-06 11:02:18 +00:00
}
export type Actions =
| CreateTotp
| CreateTotpSuccess
| CreateTotpFailure
| Regist
| RegistSuccess
| RegistFailure
| CheckCodeForMember
| CheckCodeForMemberSuccess
| CheckCodeForMemberFailure
;