view data fixes
This commit is contained in:
@@ -6,6 +6,12 @@ import { AuthPageService } from '@/lib/services/auth/AuthPageService';
|
||||
import { ResetPasswordViewData } from '@/lib/view-data/ResetPasswordViewData';
|
||||
|
||||
export class ResetPasswordPageQuery implements PageQuery<ResetPasswordViewData, URLSearchParams | Record<string, string | string[] | undefined>> {
|
||||
private readonly authService: AuthPageService;
|
||||
|
||||
constructor(authService?: AuthPageService) {
|
||||
this.authService = authService || new AuthPageService();
|
||||
}
|
||||
|
||||
async execute(searchParams: URLSearchParams | Record<string, string | string[] | undefined>): Promise<Result<ResetPasswordViewData, string>> {
|
||||
// Parse and validate search parameters
|
||||
const parsedResult = SearchParamParser.parseAuth(searchParams);
|
||||
@@ -17,7 +23,7 @@ export class ResetPasswordPageQuery implements PageQuery<ResetPasswordViewData,
|
||||
|
||||
try {
|
||||
// Use service to process parameters
|
||||
const authService = new AuthPageService();
|
||||
const authService = this.authService;
|
||||
const serviceResult = await authService.processResetPasswordParams({ returnTo, token });
|
||||
|
||||
if (serviceResult.isErr()) {
|
||||
@@ -27,8 +33,9 @@ export class ResetPasswordPageQuery implements PageQuery<ResetPasswordViewData,
|
||||
// Transform to ViewData using builder
|
||||
const viewData = ResetPasswordViewDataBuilder.build(serviceResult.unwrap());
|
||||
return Result.ok(viewData);
|
||||
} catch (error: any) {
|
||||
return Result.err(error.message || 'Failed to execute reset password page query');
|
||||
} catch (error: unknown) {
|
||||
const message = error instanceof Error ? error.message : 'Failed to execute reset password page query';
|
||||
return Result.err(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user