From 582a48dc7d1234a8d3e8a435f5fae16bdfcf7599 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sat, 20 Mar 2021 17:53:52 +0300
Subject: feat: add Transfers upload

---
 src/containers/WaybillForm.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/containers/WaybillForm.tsx')

diff --git a/src/containers/WaybillForm.tsx b/src/containers/WaybillForm.tsx
index a6a37e2..5fcdb7d 100644
--- a/src/containers/WaybillForm.tsx
+++ b/src/containers/WaybillForm.tsx
@@ -17,7 +17,7 @@ const WaybillForm: React.FC<FormikProps> = ({ setFieldValue, values }) => {
   const { data: contractors } = hooks.contractors.useList();
 
   if (!values.date) setFieldValue('date', moment().format('YYYY-MM-DD'));
-  if (!values.contractorId && contractors) setFieldValue('contractorId', contractors[0]._id);
+  if (!values.contractorId && contractors?.length) setFieldValue('contractorId', contractors[0]._id);
 
   const handleAddRecord = () => setFieldValue('records', [...values.records, {
     productId: _.map(products, '_id').reduce((acc, id) => {
-- 
cgit v1.2.3

