diff --git a/apps/web/components/editor/pdf-signer.tsx b/apps/web/components/editor/pdf-signer.tsx index 83889f334..dbbf1f9d6 100644 --- a/apps/web/components/editor/pdf-signer.tsx +++ b/apps/web/components/editor/pdf-signer.tsx @@ -28,9 +28,9 @@ export default function PDFSigner(props: any) { const [signingDone, setSigningDone] = useState(false); const [localSignatures, setLocalSignatures] = useState([]); const [fields, setFields] = useState(props.fields); - const signatureFieldCount: number = fields.filter( + const signatureFields = fields.filter( (field) => field.type === FieldType.SIGNATURE - ).length; + ); const [dialogField, setDialogField] = useState(); useEffect(() => { @@ -114,7 +114,7 @@ export default function PDFSigner(props: any) { - {signatureFieldCount === 0 ? ( + {signatureFields.length === 0 ? (
@@ -135,7 +135,7 @@ export default function PDFSigner(props: any) { {}} onDelete={onDeleteHandler} @@ -156,9 +155,11 @@ export default function PDFSigner(props: any) { function checkIfSigningIsDone(): boolean { // Check if all fields are signed.. - if (fields.length > 0) { + if (signatureFields.length > 0) { // If there are no fields to sign at least one signature is enough - return fields.every((field) => field.signature); + return fields + .filter((field) => field.type === FieldType.SIGNATURE) + .every((field) => field.signature); } else { return localSignatures.length > 0; }