40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
/**
|
|
* Reset Password View Data Builder
|
|
*
|
|
* Transforms ResetPasswordPageDTO into ViewData for the reset password template.
|
|
* Deterministic, side-effect free, no business logic.
|
|
*/
|
|
|
|
import { ResetPasswordPageDTO } from '@/lib/services/auth/types/ResetPasswordPageDTO';
|
|
|
|
export interface ResetPasswordViewData {
|
|
token: string;
|
|
returnTo: string;
|
|
showSuccess: boolean;
|
|
successMessage?: string;
|
|
formState: any; // Will be managed by client component
|
|
isSubmitting: boolean;
|
|
submitError?: string;
|
|
}
|
|
|
|
export class ResetPasswordViewDataBuilder {
|
|
static build(data: ResetPasswordPageDTO): ResetPasswordViewData {
|
|
return {
|
|
token: data.token,
|
|
returnTo: data.returnTo,
|
|
showSuccess: false,
|
|
formState: {
|
|
fields: {
|
|
newPassword: { 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,
|
|
};
|
|
}
|
|
} |