website refactor

This commit is contained in:
2026-01-16 01:32:55 +01:00
parent a98e3e3166
commit b533de8486
23 changed files with 651 additions and 159 deletions

View File

@@ -1,8 +1,8 @@
'use client';
import { useMutation, UseMutationOptions } from '@tanstack/react-query';
import { generateAvatarsAction } from '@/app/onboarding/generateAvatarsAction';
import { Result } from '@/lib/contracts/Result';
import { DomainError } from '@/lib/contracts/services/Service';
interface GenerateAvatarsParams {
userId: string;
@@ -13,17 +13,14 @@ interface GenerateAvatarsParams {
interface GenerateAvatarsResult {
success: boolean;
avatarUrls?: string[];
errorMessage?: string;
}
export function useGenerateAvatars(
options?: Omit<UseMutationOptions<Result<GenerateAvatarsResult, DomainError>, Error, GenerateAvatarsParams>, 'mutationFn'>
options?: Omit<UseMutationOptions<Result<GenerateAvatarsResult, string>, Error, GenerateAvatarsParams>, 'mutationFn'>
) {
return useMutation<Result<GenerateAvatarsResult, DomainError>, Error, GenerateAvatarsParams>({
mutationFn: async (_params) => {
// This method doesn't exist in the service yet, but the hook is now created
// The service will need to implement this or we need to adjust the architecture
return Result.ok({ success: false, errorMessage: 'Not implemented' });
return useMutation<Result<GenerateAvatarsResult, string>, Error, GenerateAvatarsParams>({
mutationFn: async (params) => {
return await generateAvatarsAction(params);
},
...options,
});