diff --git a/src/front/pages/invite.js b/src/front/pages/invite.js index e67ca9c..f79e7e6 100644 --- a/src/front/pages/invite.js +++ b/src/front/pages/invite.js @@ -13,8 +13,20 @@ const invitesFunction = () => { const signupButton = new NostrSignupButton({ parentElement: nostrSignupArea, id: 'nostr-signup-button', - onClickCallback: () => { - acceptInvite(); + onClickCallback: async () => { + const verifyResponse = + await signupService.requestAndRespondSignUpChallenge({ + onNostrErrorCallback: () => { + rejectedNostrWarning.display(); + }, + }); + + if (verifyResponse.ok) { + signUpSuccessPopup.display(); + setTimeout(() => { + window.location.href = constants.API_PATHS.createProfile; + }, constants.DEFAULT_REDIRECT_DELAY); + } }, }); signupButton.render(); @@ -93,27 +105,6 @@ const invitesFunction = () => { } ); }; - - function showConfirmationAndRedirect() { - signUpSuccessPopup.display(); - setTimeout(() => { - window.location.href = constants.API_PATHS.createProfile; - }, constants.DEFAULT_REDIRECT_DELAY); - } - - async function acceptInvite() { - const verifyResponse = await signupService.requestAndRespondSignUpChallenge( - { - onNostrErrorCallback: () => { - rejectedNostrWarning.display(); - }, - } - ); - - if (verifyResponse.ok) { - showConfirmationAndRedirect(); - } - } }; invitesFunction();