2018-04-06 11:02:18 +00:00
|
|
|
import { Action } from '@ngrx/store';
|
|
|
|
|
2018-05-24 06:44:13 +00:00
|
|
|
import { RESTClientError } from '@loafer/ng-rest';
|
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 {
|
|
|
|
CreateTotp = '[member.totp] CreateTotp',
|
|
|
|
CreateTotpSuccess = '[member.totp] CreateTotpSuccess',
|
|
|
|
CreateTotpFailure = '[member.totp] CreateTotpFailure',
|
|
|
|
|
|
|
|
Regist = '[member.totp] Regist',
|
|
|
|
RegistSuccess = '[member.totp] RegistSuccess',
|
|
|
|
RegistFailure = '[member.totp] RegistFailure',
|
|
|
|
|
|
|
|
CheckCodeForMember = '[member.totp] CheckCodeForMember',
|
|
|
|
CheckCodeForMemberSuccess = '[member.totp] CheckCodeForMemberSuccess',
|
|
|
|
CheckCodeForMemberFailure = '[member.totp] CheckCodeForMemberFailure',
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
constructor(public payload: RESTClientError) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
constructor(public payload: void) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class RegistFailure implements Action {
|
|
|
|
readonly type = ActionType.RegistFailure;
|
|
|
|
|
|
|
|
constructor(public payload: RESTClientError) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
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: void) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class CheckCodeForMemberFailure implements Action {
|
|
|
|
readonly type = ActionType.CheckCodeForMemberFailure;
|
|
|
|
|
|
|
|
constructor(public payload: RESTClientError) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
export type Actions =
|
|
|
|
| CreateTotp
|
|
|
|
| CreateTotpSuccess
|
|
|
|
| CreateTotpFailure
|
|
|
|
| Regist
|
|
|
|
| RegistSuccess
|
|
|
|
| RegistFailure
|
|
|
|
| CheckCodeForMember
|
|
|
|
| CheckCodeForMemberSuccess
|
|
|
|
| CheckCodeForMemberFailure
|
|
|
|
;
|