mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 15:53:02 +10:00
chore: refactor removal logic
This commit is contained in:
@ -116,6 +116,7 @@ export const AddSignersFormPartial = ({
|
||||
|
||||
const onFormSubmit = form.handleSubmit(onSubmit);
|
||||
|
||||
|
||||
const {
|
||||
append: appendSigner,
|
||||
fields: signers,
|
||||
@ -165,7 +166,10 @@ export const AddSignersFormPartial = ({
|
||||
};
|
||||
|
||||
const onAddSelfSigner = () => {
|
||||
if(signers.length !== 0) onRemoveSigner(0);
|
||||
const lastSignerIndex = signers.length - 1;
|
||||
if(!signers[lastSignerIndex].name || !signers[lastSignerIndex].email){
|
||||
onRemoveSigner(lastSignerIndex)
|
||||
}
|
||||
appendSigner({
|
||||
formId: nanoid(12),
|
||||
name: user?.name ?? '',
|
||||
|
||||
Reference in New Issue
Block a user