Hero: een gewijzigd focuspunt geldt pas bij het opslaan van de hero (Bryan); het focus-venster houdt de wijziging lokaal
Het eindpunt PUT /hero/images/{id}/focus is vervallen; de focus gaat mee in de opslag (imageFocus) en de varianten worden dan in nieuwe bestanden opnieuw gesneden.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { api } from '@/lib/api-client';
|
||||
import type { HeroAdminDto, HeroFocusRequest, HeroImageDto, HeroSaveRequest } from './types';
|
||||
import type { HeroAdminDto, HeroImageDto, HeroSaveRequest } from './types';
|
||||
|
||||
export const HERO_KEY = ['hero'];
|
||||
|
||||
@@ -33,17 +33,6 @@ export function useUploadHeroImage() {
|
||||
});
|
||||
}
|
||||
|
||||
export function useSetImageFocus() {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation<HeroImageDto, Error, { imageId: string; body: HeroFocusRequest }>({
|
||||
mutationFn: ({ imageId, body }) => api.put<HeroImageDto>(`/api/v1/hero/images/${imageId}/focus`, body),
|
||||
onSuccess: () => {
|
||||
// The slide list shows the image variants; they have new addresses after a change of focus.
|
||||
void queryClient.invalidateQueries({ queryKey: HERO_KEY });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function useDeleteHeroImage() {
|
||||
return useMutation<void, Error, string>({
|
||||
mutationFn: (imageId) => api.delete<void>(`/api/v1/hero/images/${imageId}`),
|
||||
|
||||
Reference in New Issue
Block a user