fix(FE-86): fixing error null value

This commit is contained in:
randy-ar
2025-10-27 10:58:49 +07:00
parent a65d00edc8
commit cbb4f7421e
+8 -8
View File
@@ -141,8 +141,8 @@ const AddChickin = () => {
options={options}
isLoading={isLoadingListProjectFlock}
value={{
label: `${projectFlock.data.flock.name} - ${projectFlock.data.category} - Periode ${projectFlock.data.period}`,
value: projectFlock.data.id,
label: `${projectFlock.data?.flock?.name} - ${projectFlock.data?.category} - Periode ${projectFlock.data?.period}`,
value: projectFlock.data?.id,
}}
onChange={(val) =>
router.push(
@@ -159,7 +159,7 @@ const AddChickin = () => {
</div>
</header>
<Table<Kandang>
data={projectFlock.data.kandangs}
data={projectFlock.data?.kandangs}
columns={[
{
header: '#',
@@ -202,7 +202,7 @@ const AddChickin = () => {
containerClassName: cn({
'mb-20':
isResponseSuccess(projectFlock) &&
projectFlock.data.kandangs?.length === 0,
projectFlock.data?.kandangs?.length === 0,
}),
tableWrapperClassName: 'overflow-x-auto min-h-full!',
tableClassName: 'font-inter w-full table-auto min-h-full!',
@@ -239,10 +239,10 @@ const AddChickin = () => {
<ChickinForm
initialValues={{
project_flock_kandang: projectFlockKandang.data,
created_user: projectFlock.data.created_user,
created_at: projectFlock.data.created_at,
updated_at: projectFlock.data.updated_at,
approval: projectFlock.data.approval,
created_user: projectFlock.data?.created_user,
created_at: projectFlock.data?.created_at,
updated_at: projectFlock.data?.updated_at,
approval: projectFlock.data?.approval,
}}
afterSubmit={handleAfterSubmit}
/>