Hinweise zu Event-section

This commit is contained in:
PxlLoewe
2025-06-24 23:19:45 -07:00
parent 86dcf15605
commit aaa2dccee7

View File

@@ -8,6 +8,7 @@ import { deleteParticipant } from "../action";
import { checkMoodleResults, handleParticipantFinished } from "../../../../../helper/events";
import { AxiosError } from "axios";
import toast from "react-hot-toast";
import { useRouter } from "next/navigation";
interface ParticipantModalProps {
participantForm: UseFormReturn<Participant>;
@@ -15,6 +16,7 @@ interface ParticipantModalProps {
}
export const ParticipantModal = ({ participantForm, ref }: ParticipantModalProps) => {
const router = useRouter();
return (
<dialog className="modal" ref={ref}>
<div className="modal-box">
@@ -42,8 +44,13 @@ export const ParticipantModal = ({ participantForm, ref }: ParticipantModalProps
label="Abschluss-Moodle-Kurs abgeschlossen"
/>
<div>
<h3 className="text-xl">Debug</h3>
<div>
<h3 className="text-xl">Debug</h3>
<p className="text-gray-500 text-sm">
Diese Aktionen Versenden u.A. Mail! Aktivitäts-log für Teilnhemer aktualisiert nicht
nach ausfühlen
</p>
</div>
<div className="flex gap-3">
<Button
className="btn-sm"
@@ -62,8 +69,9 @@ export const ParticipantModal = ({ participantForm, ref }: ParticipantModalProps
} else {
toast.error("Unbekannter Fehler beim ausführen des Workflows");
}
toast.success("Workflow erfolgreich ausgeführt");
});
toast.success("Workflow erfolgreich ausgeführt");
router.refresh();
}}
>
Event-abgeschlossen Workflow ausführen
@@ -74,7 +82,7 @@ export const ParticipantModal = ({ participantForm, ref }: ParticipantModalProps
if (!participantForm.watch("id")) return;
const participant = participantForm.getValues();
await checkMoodleResults(participant.id.toString()).catch((e) => {
const result = await checkMoodleResults(participant.id.toString()).catch((e) => {
const error = e as AxiosError;
if (
error.response?.data &&
@@ -86,6 +94,9 @@ export const ParticipantModal = ({ participantForm, ref }: ParticipantModalProps
toast.error("Unbekannter Fehler beim ausführen des Workflows");
}
});
if (!result) return;
toast(result.data.message);
router.refresh();
}}
>
Moodle-Kurs aktualisieren