mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE): Use projectFlockKandangId for next-day recording
This commit is contained in:
@@ -552,23 +552,17 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
||||
);
|
||||
|
||||
const nextDayRecordingUrl = useMemo(() => {
|
||||
if (!selectedProjectFlock) return null;
|
||||
const projectFlockId =
|
||||
typeof selectedProjectFlock.value === 'string'
|
||||
? parseInt(selectedProjectFlock.value, 10)
|
||||
: selectedProjectFlock.value;
|
||||
return `${RecordingApi.basePath}/next-day?project_flock_id=${projectFlockId}`;
|
||||
}, [selectedProjectFlock]);
|
||||
if (!projectFlockKandangLookup) return null;
|
||||
const projectFlockKandangId = projectFlockKandangLookup.id;
|
||||
return `${RecordingApi.basePath}/next-day?project_flock_kandang_id=${projectFlockKandangId}`;
|
||||
}, [projectFlockKandangLookup]);
|
||||
|
||||
const { data: nextDayRecordingData } = useSWR(
|
||||
nextDayRecordingUrl,
|
||||
nextDayRecordingUrl
|
||||
? () => {
|
||||
const projectFlockId =
|
||||
typeof selectedProjectFlock!.value === 'string'
|
||||
? parseInt(selectedProjectFlock!.value, 10)
|
||||
: selectedProjectFlock!.value;
|
||||
return RecordingApi.nextDayRecording(projectFlockId);
|
||||
const projectFlockKandangId = projectFlockKandangLookup!.id;
|
||||
return RecordingApi.nextDayRecording(projectFlockKandangId);
|
||||
}
|
||||
: null
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user