bugfix don't show half created recipient

This commit is contained in:
Timur Ercan
2023-03-19 10:21:19 +01:00
parent 559432cc15
commit 7c830d3607

View File

@ -17,7 +17,9 @@ export default function PDFEditor(props: any) {
const [fields, setFields] = useState<any[]>(props.document.Field);
const [selectedRecipient, setSelectedRecipient]: any = useState();
const [selectedFieldType, setSelectedFieldType] = useState();
const noRecipients = props?.document.Recipient.length === 0;
const noRecipients =
props?.document.Recipient.length === 0 ||
props?.document.Recipient.every((e: any) => !e.email);
const [adding, setAdding] = useState(false);
function onPositionChangedHandler(position: any, id: any) {
@ -84,6 +86,7 @@ export default function PDFEditor(props: any) {
selectedRecipient={selectedRecipient}
onChange={setSelectedFieldType}
/>
{fields.length}
</div>
</div>
</>