view data fixes

This commit is contained in:
2026-01-23 15:30:23 +01:00
parent e22033be38
commit f8099f04bc
213 changed files with 3466 additions and 3003 deletions

View File

@@ -1,35 +1,13 @@
import { ViewModel } from "../../contracts/view-models/ViewModel";
import type { LoginFormState, LoginUIState } from "./LoginInterfaces";
/**
* Login ViewModel
*
* Client-side state management for login flow.
* Immutable, class-based, contains only UI state.
*/
export interface LoginFormField {
value: string | boolean;
error?: string;
touched: boolean;
validating: boolean;
}
export interface LoginFormState {
fields: {
email: LoginFormField;
password: LoginFormField;
rememberMe: LoginFormField;
};
isValid: boolean;
isSubmitting: boolean;
submitError?: string;
submitCount: number;
}
export interface LoginUIState {
showPassword: boolean;
showErrorDetails: boolean;
}
export class LoginViewModel {
export class LoginViewModel extends ViewModel {
constructor(
public readonly returnTo: string,
public readonly hasInsufficientPermissions: boolean,
@@ -37,7 +15,9 @@ export class LoginViewModel {
public readonly uiState: LoginUIState,
public readonly mutationPending: boolean = false,
public readonly mutationError: string | null = null
) {}
) {
super();
}
// Immutable updates
withFormState(formState: LoginFormState): LoginViewModel {
@@ -93,4 +73,4 @@ export class LoginViewModel {
get formFields() {
return this.formState.fields;
}
}
}