view data fixes
This commit is contained in:
@@ -1,28 +1,13 @@
|
||||
import { ViewModel } from "../../contracts/view-models/ViewModel";
|
||||
import type { ForgotPasswordFormState } from "./ForgotPasswordInterfaces";
|
||||
|
||||
/**
|
||||
* Forgot Password ViewModel
|
||||
*
|
||||
* Client-side state management for forgot password flow.
|
||||
* Immutable, class-based, contains only UI state.
|
||||
*/
|
||||
|
||||
export interface ForgotPasswordFormField {
|
||||
value: string;
|
||||
error?: string;
|
||||
touched: boolean;
|
||||
validating: boolean;
|
||||
}
|
||||
|
||||
export interface ForgotPasswordFormState {
|
||||
fields: {
|
||||
email: ForgotPasswordFormField;
|
||||
};
|
||||
isValid: boolean;
|
||||
isSubmitting: boolean;
|
||||
submitError?: string;
|
||||
submitCount: number;
|
||||
}
|
||||
|
||||
export class ForgotPasswordViewModel {
|
||||
export class ForgotPasswordViewModel extends ViewModel {
|
||||
constructor(
|
||||
public readonly returnTo: string,
|
||||
public readonly formState: ForgotPasswordFormState,
|
||||
@@ -31,7 +16,9 @@ export class ForgotPasswordViewModel {
|
||||
public readonly magicLink: string | null = null,
|
||||
public readonly mutationPending: boolean = false,
|
||||
public readonly mutationError: string | null = null
|
||||
) {}
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
withFormState(formState: ForgotPasswordFormState): ForgotPasswordViewModel {
|
||||
return new ForgotPasswordViewModel(
|
||||
@@ -76,4 +63,4 @@ export class ForgotPasswordViewModel {
|
||||
get submitError(): string | undefined {
|
||||
return this.formState.submitError || this.mutationError || undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user