website refactor
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Signup ViewModel Builder
|
||||
*
|
||||
* Transforms API DTOs into SignupViewModel for client-side state management.
|
||||
* Deterministic, side-effect free, no business logic.
|
||||
*/
|
||||
|
||||
import { SignupViewData } from '@/lib/builders/view-data/SignupViewDataBuilder';
|
||||
import { SignupViewModel, SignupFormState, SignupUIState } from '@/lib/view-models/auth/SignupViewModel';
|
||||
|
||||
export class SignupViewModelBuilder {
|
||||
static build(viewData: SignupViewData): SignupViewModel {
|
||||
const formState: SignupFormState = {
|
||||
fields: {
|
||||
firstName: { value: '', error: undefined, touched: false, validating: false },
|
||||
lastName: { value: '', error: undefined, touched: false, validating: false },
|
||||
email: { value: '', error: undefined, touched: false, validating: false },
|
||||
password: { value: '', error: undefined, touched: false, validating: false },
|
||||
confirmPassword: { value: '', error: undefined, touched: false, validating: false },
|
||||
},
|
||||
isValid: true,
|
||||
isSubmitting: false,
|
||||
submitError: undefined,
|
||||
submitCount: 0,
|
||||
};
|
||||
|
||||
const uiState: SignupUIState = {
|
||||
showPassword: false,
|
||||
showConfirmPassword: false,
|
||||
};
|
||||
|
||||
return new SignupViewModel(
|
||||
viewData.returnTo,
|
||||
formState,
|
||||
uiState,
|
||||
false,
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user