Skip to content

Commit

Permalink
beginning of fixing mandatory occupied time field for NEW applications
Browse files Browse the repository at this point in the history
Related to #1480
  • Loading branch information
amaliejvik committed Oct 29, 2024
1 parent b5a700b commit c1b680c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions frontend/src/Components/OccupiedForm/OccupiedForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ export function RecruitmentApplicationFormPage() {

const [recruitmentApplication, setRecruitmentApplication] = useState<RecruitmentApplicationDto>();
const [openOccupiedForm, setOpenOccupiedForm] = useState(false);
const [occupiedTimesConfirmed, setOccupiedTimesConfirmed] = useState(false);
const [formData, setFormData] = useState<FormProps>();
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);

Expand All @@ -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(() => {
Expand Down

0 comments on commit c1b680c

Please sign in to comment.