website refactor
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Onboarding ViewData Builder
|
||||
*
|
||||
* Transforms API DTOs into ViewData for onboarding page.
|
||||
* Deterministic, side-effect free.
|
||||
*/
|
||||
|
||||
import { Result } from '@/lib/contracts/Result';
|
||||
import { PresentationError } from '@/lib/contracts/page-queries/PresentationError';
|
||||
import { OnboardingPageViewData } from '@/lib/view-data/OnboardingPageViewData';
|
||||
|
||||
export class OnboardingViewDataBuilder {
|
||||
static build(apiDto: Result<{ isAlreadyOnboarded: boolean }, PresentationError>): Result<OnboardingPageViewData, PresentationError> {
|
||||
if (apiDto.isErr()) {
|
||||
return Result.err(apiDto.getError());
|
||||
}
|
||||
|
||||
const data = apiDto.unwrap();
|
||||
|
||||
return Result.ok({
|
||||
isAlreadyOnboarded: data.isAlreadyOnboarded || false,
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user