feat: update add self signer logic

This commit is contained in:
Adithya Krishna
2024-04-29 17:49:50 +05:30
committed by GitHub
parent 6b5750c7bf
commit bde0f5893f

View File

@ -138,16 +138,6 @@ export const AddSignersFormPartial = ({
);
};
const onAddSelfSigner = () => {
appendSigner({
formId: nanoid(12),
name: user?.name ?? '',
email: user?.email ?? '',
role: RecipientRole.SIGNER,
actionAuth: undefined,
});
};
const onAddSigner = () => {
appendSigner({
formId: nanoid(12),
@ -174,6 +164,20 @@ export const AddSignersFormPartial = ({
removeSigner(index);
};
const onAddSelfSigner = () => {
const lastSignerIndex = signers.length - 1;
if(!signers[lastSignerIndex].name || !signers[lastSignerIndex].email){
onRemoveSigner(lastSignerIndex)
}
appendSigner({
formId: nanoid(12),
name: user?.name ?? '',
email: user?.email ?? '',
role: RecipientRole.SIGNER,
actionAuth: undefined,
});
};
const onKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
if (event.key === 'Enter' && event.target instanceof HTMLInputElement) {
onAddSigner();