37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
/**
|
|
* Signup View Data Builder
|
|
*
|
|
* Transforms SignupPageDTO into ViewData for the signup template.
|
|
* Deterministic, side-effect free, no business logic.
|
|
*/
|
|
|
|
import { SignupPageDTO } from '@/lib/services/auth/types/SignupPageDTO';
|
|
import { SignupViewData } from '../../view-data/SignupViewData';
|
|
import { ViewDataBuilder } from '../../contracts/builders/ViewDataBuilder';
|
|
|
|
export class SignupViewDataBuilder implements ViewDataBuilder<SignupPageDTO, SignupViewData> {
|
|
build(apiDto: SignupPageDTO): SignupViewData {
|
|
return SignupViewDataBuilder.build(apiDto);
|
|
}
|
|
|
|
static build(apiDto: SignupPageDTO): SignupViewData {
|
|
return {
|
|
returnTo: apiDto.returnTo,
|
|
formState: {
|
|
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,
|
|
},
|
|
isSubmitting: false,
|
|
submitError: undefined,
|
|
};
|
|
}
|
|
} |