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 onFormSubmit = form.handleSubmit(onSubmit);
|
||||||
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
append: appendSigner,
|
append: appendSigner,
|
||||||
fields: signers,
|
fields: signers,
|
||||||
@ -124,7 +125,7 @@ export const AddSignersFormPartial = ({
|
|||||||
control,
|
control,
|
||||||
name: 'signers',
|
name: 'signers',
|
||||||
});
|
});
|
||||||
|
|
||||||
const hasBeenSentToRecipientId = (id?: number) => {
|
const hasBeenSentToRecipientId = (id?: number) => {
|
||||||
if (!id) {
|
if (!id) {
|
||||||
return false;
|
return false;
|
||||||
@ -165,7 +166,10 @@ export const AddSignersFormPartial = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onAddSelfSigner = () => {
|
const onAddSelfSigner = () => {
|
||||||
if(signers.length !== 0) onRemoveSigner(0);
|
const lastSignerIndex = signers.length - 1;
|
||||||
|
if(!signers[lastSignerIndex].name || !signers[lastSignerIndex].email){
|
||||||
|
onRemoveSigner(lastSignerIndex)
|
||||||
|
}
|
||||||
appendSigner({
|
appendSigner({
|
||||||
formId: nanoid(12),
|
formId: nanoid(12),
|
||||||
name: user?.name ?? '',
|
name: user?.name ?? '',
|
||||||
|
|||||||
Reference in New Issue
Block a user