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(() => {
|
const nextDayRecordingUrl = useMemo(() => {
|
||||||
if (!selectedProjectFlock) return null;
|
if (!projectFlockKandangLookup) return null;
|
||||||
const projectFlockId =
|
const projectFlockKandangId = projectFlockKandangLookup.id;
|
||||||
typeof selectedProjectFlock.value === 'string'
|
return `${RecordingApi.basePath}/next-day?project_flock_kandang_id=${projectFlockKandangId}`;
|
||||||
? parseInt(selectedProjectFlock.value, 10)
|
}, [projectFlockKandangLookup]);
|
||||||
: selectedProjectFlock.value;
|
|
||||||
return `${RecordingApi.basePath}/next-day?project_flock_id=${projectFlockId}`;
|
|
||||||
}, [selectedProjectFlock]);
|
|
||||||
|
|
||||||
const { data: nextDayRecordingData } = useSWR(
|
const { data: nextDayRecordingData } = useSWR(
|
||||||
nextDayRecordingUrl,
|
nextDayRecordingUrl,
|
||||||
nextDayRecordingUrl
|
nextDayRecordingUrl
|
||||||
? () => {
|
? () => {
|
||||||
const projectFlockId =
|
const projectFlockKandangId = projectFlockKandangLookup!.id;
|
||||||
typeof selectedProjectFlock!.value === 'string'
|
return RecordingApi.nextDayRecording(projectFlockKandangId);
|
||||||
? parseInt(selectedProjectFlock!.value, 10)
|
|
||||||
: selectedProjectFlock!.value;
|
|
||||||
return RecordingApi.nextDayRecording(projectFlockId);
|
|
||||||
}
|
}
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user