fix: P0 stabilisation — score modifiers, logout cache clear, provider isolation, mutation error feedback
- scoreCalculator: apply dataQuality/confidence modifiers to finalScore (were computed but hardcoded to 0) - authService: call queryClient.clear() on logout to prevent cross-session data leakage - queryClient: extract to src/lib/queryClient.ts singleton so services can access it without circular imports - matchSyncService: new service layer owns match-generation logic; MockupNeedProvider no longer imports other providers directly - hooks (11 files): add onError + German toast feedback to every useMutation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useMutation } from '@tanstack/react-query'
|
||||
import { offerService } from '../services/offerService'
|
||||
import type { AssetType } from '../domain/enums'
|
||||
import { useToastStore } from '../stores/toastStore'
|
||||
|
||||
export function useCreateOfferDraft() {
|
||||
return useMutation({
|
||||
@@ -20,6 +21,9 @@ export function useCreateOfferDraft() {
|
||||
input.assetType,
|
||||
input.sizeRange,
|
||||
),
|
||||
onError: () => {
|
||||
useToastStore.getState().showToast('Angebot konnte nicht erstellt werden.', 'error')
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -27,23 +31,35 @@ export function useUpdateOfferField() {
|
||||
return useMutation({
|
||||
mutationFn: (input: { offerDraftId: string; fieldId: string; value: string }) =>
|
||||
offerService.updateOfferField(input.offerDraftId, input.fieldId, input.value),
|
||||
onError: () => {
|
||||
useToastStore.getState().showToast('Feld konnte nicht gespeichert werden.', 'error')
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function useMarkOfferChecked() {
|
||||
return useMutation({
|
||||
mutationFn: (offerDraftId: string) => offerService.markOfferChecked(offerDraftId),
|
||||
onError: () => {
|
||||
useToastStore.getState().showToast('Prüfung konnte nicht gespeichert werden.', 'error')
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function useGeneratePdfPreview() {
|
||||
return useMutation({
|
||||
mutationFn: (offerDraftId: string) => offerService.generatePdfPreview(offerDraftId),
|
||||
onError: () => {
|
||||
useToastStore.getState().showToast('PDF-Vorschau konnte nicht generiert werden.', 'error')
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function useSendOffer() {
|
||||
return useMutation({
|
||||
mutationFn: (offerDraftId: string) => offerService.sendOffer(offerDraftId),
|
||||
onError: () => {
|
||||
useToastStore.getState().showToast('Angebot konnte nicht gesendet werden. Bitte versuchen Sie es erneut.', 'error')
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user