mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
feat: update add self signer logic
This commit is contained in:
@ -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 = () => {
|
const onAddSigner = () => {
|
||||||
appendSigner({
|
appendSigner({
|
||||||
formId: nanoid(12),
|
formId: nanoid(12),
|
||||||
@ -174,6 +164,20 @@ export const AddSignersFormPartial = ({
|
|||||||
removeSigner(index);
|
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>) => {
|
const onKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
|
||||||
if (event.key === 'Enter' && event.target instanceof HTMLInputElement) {
|
if (event.key === 'Enter' && event.target instanceof HTMLInputElement) {
|
||||||
onAddSigner();
|
onAddSigner();
|
||||||
|
|||||||
Reference in New Issue
Block a user