member_webapp/@overflow/member/store/entity/member-totp/member-totp.action.ts
2018-05-29 18:32:22 +09:00

88 lines
2.5 KiB
TypeScript

import { Action } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { Member } from '@overflow/commons-typescript/model/member';
export enum ActionType {
CreateTotp = '[member.member-totp] CreateTotp',
CreateTotpSuccess = '[member.member-totp] CreateTotpSuccess',
CreateTotpFailure = '[member.member-totp] CreateTotpFailure',
Regist = '[member.member-totp] Regist',
RegistSuccess = '[member.member-totp] RegistSuccess',
RegistFailure = '[member.member-totp] RegistFailure',
CheckCodeForMember = '[member.member-totp] CheckCodeForMember',
CheckCodeForMemberSuccess = '[member.member-totp] CheckCodeForMemberSuccess',
CheckCodeForMemberFailure = '[member.member-totp] CheckCodeForMemberFailure',
}
export class CreateTotp implements Action {
readonly type = ActionType.CreateTotp;
constructor(public payload: Member) {}
}
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;
constructor(public payload: RPCClientError) {}
}
// ----------------------------------------------------------------------------------------
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;
constructor(public payload: RPCClientError) {}
}
// ----------------------------------------------------------------------------------------
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;
constructor(public payload: boolean) {}
}
export class CheckCodeForMemberFailure implements Action {
readonly type = ActionType.CheckCodeForMemberFailure;
constructor(public payload: RPCClientError) {}
}
export type Actions =
| CreateTotp
| CreateTotpSuccess
| CreateTotpFailure
| Regist
| RegistSuccess
| RegistFailure
| CheckCodeForMember
| CheckCodeForMemberSuccess
| CheckCodeForMemberFailure
;