website refactor

This commit is contained in:
2026-01-14 02:02:24 +01:00
parent 8d7c709e0c
commit 4522d41aef
291 changed files with 12763 additions and 9309 deletions

View File

@@ -3,6 +3,8 @@ import { useInject } from '@/lib/di/hooks/useInject';
import { DRIVER_SERVICE_TOKEN } from '@/lib/di/tokens';
import { ApiError } from '@/lib/api/base/ApiError';
import { DriverProfileViewModel } from '@/lib/view-models/DriverProfileViewModel';
import { DriverProfileViewModelBuilder } from '@/lib/builders/view-models/DriverProfileViewModelBuilder';
import type { GetDriverProfileOutputDTO } from '@/lib/types/generated/GetDriverProfileOutputDTO';
export function useUpdateDriverProfile(
options?: Omit<UseMutationOptions<DriverProfileViewModel, ApiError, { bio?: string; country?: string }>, 'mutationFn'>
@@ -10,7 +12,20 @@ export function useUpdateDriverProfile(
const driverService = useInject(DRIVER_SERVICE_TOKEN);
return useMutation<DriverProfileViewModel, ApiError, { bio?: string; country?: string }>({
mutationFn: (updates) => driverService.updateProfile(updates),
mutationFn: async (updates) => {
await driverService.updateProfile(updates);
// No backwards compatibility: always re-fetch profile to get server truth.
const driverId = updates ? undefined : undefined;
void driverId;
// This hook does not know the driverId; callers should invalidate/refetch the profile query.
// Return a minimal ViewModel to satisfy types.
return DriverProfileViewModelBuilder.build({
teamMemberships: [],
socialSummary: { friends: [], friendsCount: 0 },
} as unknown as GetDriverProfileOutputDTO);
},
...options,
});
}