refactor(FE): Use location type guard for warehouse access

This commit is contained in:
rstubryan
2026-01-20 10:08:37 +07:00
parent 6319b6d5fe
commit 0e179f1643
@@ -324,12 +324,14 @@ const PurchaseOrderInvoice = ({ data }: PurchaseOrderInvoiceProps) => {
PT LUMBUNG TELUR INDONESIA PT LUMBUNG TELUR INDONESIA
</Text> </Text>
<Text> <Text>
{purchaseData?.items?.[0]?.warehouse.type === 'LOKASI' {purchaseData?.items?.[0]?.warehouse &&
'location' in purchaseData.items[0].warehouse
? purchaseData.items[0].warehouse.location.name ? purchaseData.items[0].warehouse.location.name
: '-'} : '-'}
</Text> </Text>
<Text> <Text>
{purchaseData?.items?.[0]?.warehouse.type === 'LOKASI' {purchaseData?.items?.[0]?.warehouse &&
'location' in purchaseData.items[0].warehouse
? purchaseData.items[0].warehouse.location.address ? purchaseData.items[0].warehouse.location.address
: '-'} : '-'}
</Text> </Text>
@@ -434,7 +436,7 @@ const PurchaseOrderInvoice = ({ data }: PurchaseOrderInvoiceProps) => {
</View> </View>
<View style={pdfStyles.tableCell}> <View style={pdfStyles.tableCell}>
<Text> <Text>
{item.warehouse?.type === 'LOKASI' {item.warehouse && 'location' in item.warehouse
? item.warehouse.location.address ? item.warehouse.location.address
: '-'} : '-'}
</Text> </Text>