Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 7x 2x 1x 1x | import { useMutation } from "@tanstack/react-query";
import { useToastStore } from "../presentation/stores/toast.store";
import { createSuggestion } from "../infrastructure/suggestion.api";
interface SuggestionParams {
senderEmail: string|null;
label: string;
}
export function useCreateSuggestion() {
const addToast = useToastStore(s => s.addToast);
return useMutation<void, Error, SuggestionParams>({
mutationFn: (params) => createSuggestion(params),
onSuccess: () => {
addToast({ type: "success", message: "Suggestion enregistrée !" });
},
onError: (err) => {
addToast({ type: "error", message: err.message || "Erreur lors de l'envoi" });
}
});
}
|