Commit d623bb99 authored by Emily Jensen's avatar Emily Jensen

Added actions, effects, and reducer files to mfa account component

parent 216a159e
Pipeline #60739767 passed with stage
in 12 minutes and 57 seconds
import { Action } from "@ngrx/store";
export enum ManageMfaActionTypes {
ENABLE_MFA = "[ENABLE MFA] Enable",
ENABLE_MFA_SUCCESS = "[ENABLE MFA] Enable Success",
ENABLE_MFA_FAILURE = "[ENABLE MFA] Enable Failure",
DISABLE_MFA = "[DISABLE MFA] Disable",
DISABLE_MFA_SUCCESS = "[DISABLE MFA] Disable Success",
DISABLE_MFA_FAILURE = "[DISABLE MFA] Disable Failure"
}
export class EnableMfa implements Action {
readonly type = ManageMfaActionTypes.ENABLE_MFA;
}
export class EnableMfaSuccess implements Action {
readonly type = ManageMfaActionTypes.ENABLE_MFA_SUCCESS;
}
export class EnableMfaFailure implements Action {
readonly type = ManageMfaActionTypes.ENABLE_MFA_FAILURE;
}
export class DisableMfa implements Action {
readonly type = ManageMfaActionTypes.DISABLE_MFA;
}
export class DisableMfaSuccess implements Action {
readonly type = ManageMfaActionTypes.DISABLE_MFA_SUCCESS;
}
export class DisableMfaFailure implements Action {
readonly type = ManageMfaActionTypes.DISABLE_MFA_FAILURE;
}
export type ManageMfaActions =
| EnableMfa
| EnableMfaSuccess
| EnableMfaFailure
| DisableMfa
| DisableMfaSuccess
| DisableMfaFailure;
import {
FormGroupState,
validate,
updateGroup,
createFormGroupState
} from "ngrx-forms";
import { required } from "ngrx-forms/validation";
import { IBaseFormState } from "~/app/utils/interfaces";
export const FORM_ID = "Enable MFA Form";
export interface IEnableMfaForm {
verificationCode: string;
}
export interface IState extends IBaseFormState {
enableForm: FormGroupState<IEnableMfaForm>;
errorMessage: string[] | null;
mfaEnabled: boolean | null;
}
const validateAndUpdateFormState = updateGroup<IEnableMfaForm>({
verificationCode: validate(required)
});
export const mfaEnabled = (state: IState) => state.mfaEnabled;
export const initialFormState = validateAndUpdateFormState(
createFormGroupState<IEnableMfaForm>(FORM_ID, {
verificationCode: ""
})
);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment