From c1b680ca0f2fff634ba9b833fac06fdd0f91698e Mon Sep 17 00:00:00 2001 From: amaliejvik Date: Tue, 29 Oct 2024 21:45:57 +0100 Subject: [PATCH] beginning of fixing mandatory occupied time field for NEW applications Related to #1480 --- frontend/src/Components/OccupiedForm/OccupiedForm.tsx | 3 +++ .../RecruitmentApplicationFormPage.tsx | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/Components/OccupiedForm/OccupiedForm.tsx b/frontend/src/Components/OccupiedForm/OccupiedForm.tsx index 602661d81..ed6c2b699 100644 --- a/frontend/src/Components/OccupiedForm/OccupiedForm.tsx +++ b/frontend/src/Components/OccupiedForm/OccupiedForm.tsx @@ -31,7 +31,9 @@ export function OccupiedForm({ recruitmentId = 1, onCancel, onConfirm, header, s // biome-ignore lint/correctness/useExhaustiveDependencies: t does not need to be in deplist useEffect(() => { + console.log('RecruitmendID:', recruitmentId); if (!recruitmentId) { + console.log('her'); return; } setLoading(true); @@ -45,6 +47,7 @@ export function OccupiedForm({ recruitmentId = 1, onCancel, onConfirm, header, s setMinDate(new Date(response.data.start_date)); setMaxDate(new Date(response.data.end_date)); setTimeslots(response.data.timeslots); + console.log('Response:', response.data); }), getOccupiedTimeslots(recruitmentId).then((res) => { setOccupiedTimeslots(res.data.dates); diff --git a/frontend/src/Pages/RecruitmentApplicationFormPage/RecruitmentApplicationFormPage.tsx b/frontend/src/Pages/RecruitmentApplicationFormPage/RecruitmentApplicationFormPage.tsx index d9554fb8e..edd24be66 100644 --- a/frontend/src/Pages/RecruitmentApplicationFormPage/RecruitmentApplicationFormPage.tsx +++ b/frontend/src/Pages/RecruitmentApplicationFormPage/RecruitmentApplicationFormPage.tsx @@ -39,9 +39,8 @@ export function RecruitmentApplicationFormPage() { const [recruitmentApplication, setRecruitmentApplication] = useState(); const [openOccupiedForm, setOpenOccupiedForm] = useState(false); - const [occupiedTimesConfirmed, setOccupiedTimesConfirmed] = useState(false); const [formData, setFormData] = useState(); - const [recruitmentId, setRecruitmentId] = useState(0); + const [recruitmentId, setRecruitmentId] = useState(0); //Problem del 1: settes til 0 når recruitmentapplication ikke allerede eksisterer const [loading, setLoading] = useState(true); @@ -64,7 +63,7 @@ export function RecruitmentApplicationFormPage() { }), getRecruitmentApplicationForPosition(positionId as string).then((res) => { setRecruitmentApplication(res.data); - setRecruitmentId(res.data.recruitment); + setRecruitmentId(res.data.recruitment); //Problem del 2: henter recruitmentId fra recruitmentApplication (problem når recruitmentApplication ikke eksisterer) console.log(res.data); }), ]).then(() => {